v0.25.1
This commit is contained in:
1 parent
87e571c170
commit
fa7abc9e53
308 files changed
+49746
-50237
No files matched your search
@@ -0,0 +1,32 @@
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn removes_nominated_fields_and_preserves_cookies() {
|
||||
let mut h = HeaderMap::new();
|
||||
h.insert("connection", "keep-alive, X-Internal".parse().unwrap());
|
||||
h.insert("x-internal", "secret".parse().unwrap());
|
||||
h.insert("keep-alive", "timeout=5".parse().unwrap());
|
||||
h.append("set-cookie", "a=1".parse().unwrap());
|
||||
h.append("set-cookie", "b=2".parse().unwrap());
|
||||
strip_hop_by_hop(&mut h);
|
||||
assert!(!h.contains_key("x-internal"));
|
||||
assert!(!h.contains_key("connection"));
|
||||
assert_eq!(h.get_all("set-cookie").iter().count(), 2);
|
||||
}
|
||||
#[test]
|
||||
fn upgrade_is_case_insensitive() {
|
||||
let mut h = HeaderMap::new();
|
||||
h.insert("connection", "keep-alive, Upgrade".parse().unwrap());
|
||||
assert!(requests_upgrade(&h));
|
||||
}
|
||||
#[test]
|
||||
fn admin_cookie_can_be_restored_only_from_captured_fragment() {
|
||||
let mut h = HeaderMap::new();
|
||||
h.insert("cookie", "a=1; rustproxy_session=secret; b=2".parse().unwrap());
|
||||
let admin = strip_admin_cookie(&mut h);
|
||||
assert_eq!(h.get("cookie").unwrap(), "a=1; b=2");
|
||||
assert_eq!(admin, vec!["rustproxy_session=secret"]);
|
||||
restore_admin_cookie(&mut h, &admin);
|
||||
assert_eq!(h.get("cookie").unwrap(), "a=1; b=2; rustproxy_session=secret");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user