-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"error decoding response body" is not enough #2373
Comments
The debug string |
It also likely has the serde error as a cause, which isn't shown in the |
May be it is not clear, but Obviosly Probable fix will be: @@ -265,9 +265,10 @@ impl Response {
#[cfg(feature = "json")]
#[cfg_attr(docsrs, doc(cfg(feature = "json")))]
pub async fn json<T: DeserializeOwned>(self) -> crate::Result<T> {
+ let url = *self.url.clone();
let full = self.bytes().await?;
- serde_json::from_slice(&full).map_err(crate::error::decode)
+ serde_json::from_slice(&full).map_err(|err| crate::error::decode(err).with_url(url))
} |
I use reqwest (0.12.5) like this:
If error occured, I got
reqwest::Error
, but there is no URL in it,so
println!("{err}");
just gives:Because of I use 10 different url, it is not clear what exactly happens from error.
It would be nice, if error in case of json decode error contains URL.
The text was updated successfully, but these errors were encountered: