|
|
@ -18,12 +18,12 @@ func Parse(resp *http.Response, val interface{}) error {
|
|
|
|
return ParseJsonBody(resp, val)
|
|
|
|
return ParseJsonBody(resp, val)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ParseHeaders parses the rsponse headers.
|
|
|
|
// ParseHeaders parses the response headers.
|
|
|
|
func ParseHeaders(resp *http.Response, val interface{}) error {
|
|
|
|
func ParseHeaders(resp *http.Response, val interface{}) error {
|
|
|
|
return encoding.ParseHeaders(resp.Header, val)
|
|
|
|
return encoding.ParseHeaders(resp.Header, val)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ParseJsonBody parses the rsponse body, which should be in json content type.
|
|
|
|
// ParseJsonBody parses the response body, which should be in json content type.
|
|
|
|
func ParseJsonBody(resp *http.Response, val interface{}) error {
|
|
|
|
func ParseJsonBody(resp *http.Response, val interface{}) error {
|
|
|
|
if withJsonBody(resp) {
|
|
|
|
if withJsonBody(resp) {
|
|
|
|
return mapping.UnmarshalJsonReader(resp.Body, val)
|
|
|
|
return mapping.UnmarshalJsonReader(resp.Body, val)
|
|
|
|