fix(json): bump serde_json dependency and fix failing test

This commit is contained in:
Harsh Shandilya authored and Martin Algesten committed 2023-06-17 00:07:12 +02:00
1 parent ed2dd3ade4
commit 406b41a264
2 files changed
+4 -7

No files matched your search

+3 -6
View File
@@ -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());
}
}