|
|
@ -26,15 +26,10 @@ impl Client { |
|
|
|
let response = self.client.request(request)?; |
|
|
|
let response = self.client.request(request)?; |
|
|
|
let status = response.status(); |
|
|
|
let status = response.status(); |
|
|
|
if !status.is_successful() { |
|
|
|
if !status.is_successful() { |
|
|
|
return Err(Error::new( |
|
|
|
return Err(Error::other(format!( |
|
|
|
ErrorKind::Other, |
|
|
|
"Error {status} returned by {url} with payload:\n{}", |
|
|
|
format!( |
|
|
|
response.into_body().to_string()? |
|
|
|
"Error {} returned by {} with payload:\n{}", |
|
|
|
))); |
|
|
|
status, |
|
|
|
|
|
|
|
url, |
|
|
|
|
|
|
|
response.into_body().to_string()? |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
let content_type = response |
|
|
|
let content_type = response |
|
|
|
.header(&HeaderName::CONTENT_TYPE) |
|
|
|
.header(&HeaderName::CONTENT_TYPE) |
|
|
@ -61,15 +56,10 @@ impl Client { |
|
|
|
let response = self.client.request(request)?; |
|
|
|
let response = self.client.request(request)?; |
|
|
|
let status = response.status(); |
|
|
|
let status = response.status(); |
|
|
|
if !status.is_successful() { |
|
|
|
if !status.is_successful() { |
|
|
|
return Err(Error::new( |
|
|
|
return Err(Error::other(format!( |
|
|
|
ErrorKind::Other, |
|
|
|
"Error {status} returned by {url} with payload:\n{}", |
|
|
|
format!( |
|
|
|
response.into_body().to_string()? |
|
|
|
"Error {} returned by {} with payload:\n{}", |
|
|
|
))); |
|
|
|
status, |
|
|
|
|
|
|
|
url, |
|
|
|
|
|
|
|
response.into_body().to_string()? |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
let content_type = response |
|
|
|
let content_type = response |
|
|
|
.header(&HeaderName::CONTENT_TYPE) |
|
|
|
.header(&HeaderName::CONTENT_TYPE) |
|
|
|