Add set_cookie test
This commit is contained in:
committed by
Martin Algesten
parent
a75d924f96
commit
9f4a7acacb
@@ -11,3 +11,30 @@ fn tls_connection_close() {
|
|||||||
assert_eq!(resp.status(), 404);
|
assert_eq!(resp.status(), 404);
|
||||||
resp.into_reader().read_to_end(&mut vec![]).unwrap();
|
resp.into_reader().read_to_end(&mut vec![]).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "tls")]
|
||||||
|
#[cfg(feature = "cookies")]
|
||||||
|
#[cfg(feature = "json")]
|
||||||
|
#[test]
|
||||||
|
fn agent_set_cookie() {
|
||||||
|
let agent = ureq::Agent::default().build();
|
||||||
|
let cookie = ureq::Cookie::build("name", "value")
|
||||||
|
.domain("httpbin.org")
|
||||||
|
.secure(true)
|
||||||
|
.finish();
|
||||||
|
agent.set_cookie(cookie);
|
||||||
|
let resp = agent
|
||||||
|
.get("https://httpbin.org/get")
|
||||||
|
.set("Connection", "close")
|
||||||
|
.call();
|
||||||
|
assert_eq!(resp.status(), 200);
|
||||||
|
assert_eq!(
|
||||||
|
"name=value",
|
||||||
|
resp.into_json()
|
||||||
|
.unwrap()
|
||||||
|
.get("headers")
|
||||||
|
.unwrap()
|
||||||
|
.get("Cookie")
|
||||||
|
.unwrap()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user