fix(json): bump serde_json dependency and fix failing test
This commit is contained in:
committed by
Martin Algesten
parent
ed2dd3ade4
commit
406b41a264
@@ -33,7 +33,7 @@ once_cell = "1"
|
||||
url = "2"
|
||||
socks = { version = "0.3", optional = true }
|
||||
serde = { version = "1", optional = true }
|
||||
serde_json = { version = ">=1,<1.0.94", optional = true }
|
||||
serde_json = { version = ">=1.0.97", optional = true }
|
||||
encoding_rs = { version = "0.8", optional = true }
|
||||
cookie_store = { version = "0.19", optional = true, default-features = false, features = ["preserve_order"] }
|
||||
log = "0.4"
|
||||
|
||||
@@ -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