avoid parsing when setting headers

This commit is contained in:
Martin Algesten
2018-07-01 18:33:50 +02:00
parent 1812b7f6b8
commit 51744804da
4 changed files with 23 additions and 20 deletions

View File

@@ -204,8 +204,7 @@ fn match_cookies<'a>(jar: &'a CookieJar, domain: &str, path: &str, is_secure: bo
let name = c.name().to_string();
let value = c.value().to_string();
let nameval = Cookie::new(name, value).encoded().to_string();
let head = format!("Cookie: {}", nameval);
head.parse::<Header>().ok()
Header::new("Cookie", &nameval).ok()
})
.filter(|o| o.is_some())
.map(|o| o.unwrap())