Skip to content

Commit f368310

Browse files
committed
use Cookie::parse_encoded
1 parent ace8bc6 commit f368310

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/cookies/middleware.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl CookieData {
8383
for cookie_header in cookie_headers {
8484
// spec says there should be only one, so this is permissive
8585
for pair in cookie_header.as_str().split(";") {
86-
if let Ok(cookie) = Cookie::parse(String::from(pair)) {
86+
if let Ok(cookie) = Cookie::parse_encoded(String::from(pair)) {
8787
jar.add_original(cookie);
8888
}
8989
}

tests/cookies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn make_request(endpoint: &str) -> http_types::Response {
5353
);
5454
req.insert_header(
5555
http_types::headers::COOKIE,
56-
"testCookie=RequestCookieValue; secondTestCookie=OtherCookieValue",
56+
"testCookie=RequestCookieValue; secondTestCookie=Other%3BCookie%20Value",
5757
)
5858
.unwrap();
5959

@@ -71,7 +71,7 @@ fn successfully_retrieve_request_cookie() {
7171
String::from_utf8(buffer).unwrap()
7272
});
7373

74-
assert_eq!(&body, "RequestCookieValue and also OtherCookieValue");
74+
assert_eq!(&body, "RequestCookieValue and also Other;Cookie Value");
7575
}
7676

7777
#[test]

0 commit comments

Comments
 (0)