mirror of
https://github.com/fafhrd91/actix-web
synced 2024-12-02 19:32:24 +01:00
set test cookie if it is not empty
This commit is contained in:
parent
50a0cb5653
commit
6436004194
10
src/test.rs
10
src/test.rs
@ -172,10 +172,12 @@ impl TestRequest {
|
|||||||
let value = percent_encode(c.value().as_bytes(), USERINFO_ENCODE_SET);
|
let value = percent_encode(c.value().as_bytes(), USERINFO_ENCODE_SET);
|
||||||
let _ = write!(&mut cookie, "; {}={}", name, value);
|
let _ = write!(&mut cookie, "; {}={}", name, value);
|
||||||
}
|
}
|
||||||
head.headers.insert(
|
if !cookie.is_empty() {
|
||||||
header::COOKIE,
|
head.headers.insert(
|
||||||
HeaderValue::from_str(&cookie.as_str()[2..]).unwrap(),
|
header::COOKIE,
|
||||||
);
|
HeaderValue::from_str(&cookie.as_str()[2..]).unwrap(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
req
|
req
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user