fix(json): bump serde_json dependency and fix failing test
This commit is contained in:
committed by
Martin Algesten
parent
ed2dd3ade4
commit
406b41a264
@@ -533,16 +533,13 @@ impl Response {
|
||||
#[cfg(feature = "json")]
|
||||
pub fn into_json<T: DeserializeOwned>(self) -> io::Result<T> {
|
||||
use crate::stream::io_err_timeout;
|
||||
use std::error::Error;
|
||||
|
||||
let reader = self.into_reader();
|
||||
serde_json::from_reader(reader).map_err(|e| {
|
||||
// This is to unify TimedOut io::Error in the API.
|
||||
// We make a clone of the original error since serde_json::Error doesn't
|
||||
// let us get the wrapped error instance back.
|
||||
if let Some(ioe) = e.source().and_then(|s| s.downcast_ref::<io::Error>()) {
|
||||
if ioe.kind() == io::ErrorKind::TimedOut {
|
||||
return io_err_timeout(ioe.to_string());
|
||||
if let Some(kind) = e.io_error_kind() {
|
||||
if kind == io::ErrorKind::TimedOut {
|
||||
return io_err_timeout(e.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user