better test
This commit is contained in:
@@ -43,14 +43,11 @@ fn agent_cookies() {
|
||||
assert!(agent.cookie("foo").is_some());
|
||||
assert_eq!(agent.cookie("foo").unwrap().value(), "bar baz");
|
||||
|
||||
test::set_handler("/agent_cookies", |_unit| {
|
||||
test::set_handler("/agent_cookies", |unit| {
|
||||
assert!(unit.has("cookie"));
|
||||
assert_eq!(unit.header("cookie").unwrap(), "foo=bar%20baz");
|
||||
test::make_response(200, "OK", vec![], vec![])
|
||||
});
|
||||
|
||||
let resp = agent.get("test://host/agent_cookies").call();
|
||||
|
||||
let vec = resp.to_write_vec();
|
||||
let s = String::from_utf8_lossy(&vec);
|
||||
|
||||
assert!(s.contains("Cookie: foo=bar%20baz\r\n"));
|
||||
agent.get("test://host/agent_cookies").call();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user