Merge into_json_deserialize into into_json.
This commit is contained in:
@@ -75,7 +75,7 @@ fn body_as_json() {
|
||||
)
|
||||
});
|
||||
let resp = get("test://host/body_as_json").call().unwrap();
|
||||
let json = resp.into_json().unwrap();
|
||||
let json: serde_json::Value = resp.into_json().unwrap();
|
||||
assert_eq!(json["hello"], "world");
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ fn body_as_json_deserialize() {
|
||||
)
|
||||
});
|
||||
let resp = get("test://host/body_as_json_deserialize").call().unwrap();
|
||||
let json = resp.into_json_deserialize::<Hello>().unwrap();
|
||||
let json: Hello = resp.into_json().unwrap();
|
||||
assert_eq!(json.hello, "world");
|
||||
}
|
||||
|
||||
|
||||
@@ -138,9 +138,9 @@ fn overall_timeout_reading_json() {
|
||||
|
||||
let timeout = Duration::from_millis(500);
|
||||
let agent = builder().timeout(timeout).build();
|
||||
let resp = agent.get(&url).call().unwrap();
|
||||
let result: Result<serde_json::Value, io::Error> = agent.get(&url).call().unwrap().into_json();
|
||||
|
||||
match resp.into_json() {
|
||||
match result {
|
||||
Ok(_) => Err("successful response".to_string()),
|
||||
Err(e) => match e.kind() {
|
||||
io::ErrorKind::TimedOut => Ok(()),
|
||||
|
||||
Reference in New Issue
Block a user