mirror of
https://github.com/actix/actix-web.git
synced 2024-11-03 15:39:50 +00:00
set test cookie if it is not empty
This commit is contained in:
parent
50a0cb5653
commit
6436004194
1 changed files with 6 additions and 4 deletions
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 _ = write!(&mut cookie, "; {}={}", name, value);
|
||||
}
|
||||
head.headers.insert(
|
||||
header::COOKIE,
|
||||
HeaderValue::from_str(&cookie.as_str()[2..]).unwrap(),
|
||||
);
|
||||
if !cookie.is_empty() {
|
||||
head.headers.insert(
|
||||
header::COOKIE,
|
||||
HeaderValue::from_str(&cookie.as_str()[2..]).unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
req
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue