1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-27 15:29:03 +02:00

Session should write percent encoded cookies and add cookie middleware test (#393)

* Should write percent encoded cookies to HTTP response

* Add cookie middleware test
This commit is contained in:
Douman
2018-07-17 08:38:18 +03:00
committed by GitHub
parent 1af5aa3a3e
commit 29a275b0f5
3 changed files with 79 additions and 3 deletions

View File

@ -410,7 +410,7 @@ impl CookieSessionInner {
}
for cookie in jar.delta() {
let val = HeaderValue::from_str(&cookie.to_string())?;
let val = HeaderValue::from_str(&cookie.encoded().to_string())?;
resp.headers_mut().append(header::SET_COOKIE, val);
}
@ -464,6 +464,9 @@ impl CookieSessionInner {
/// all session data is lost. The constructors will panic if the key is less
/// than 32 bytes in length.
///
/// The backend relies on `cookie` crate to create and read cookies.
/// By default all cookies are percent encoded, but certain symbols may
/// cause troubles when reading cookie, if they are not properly percent encoded.
///
/// # Example
///