1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-30 18:44:35 +01:00

bump cookie crate to 0.18.

This commit is contained in:
Frederic Henrichs 2024-04-17 11:24:24 +02:00
parent ba7fd048b6
commit 14f3a0351a
7 changed files with 15 additions and 15 deletions

View File

@ -99,7 +99,7 @@ ahash = "0.8"
bytes = "1" bytes = "1"
bytestring = "1" bytestring = "1"
cfg-if = "1" cfg-if = "1"
cookie = { version = "0.16", features = ["percent-encode"], optional = true } cookie = { version = "0.18", features = ["percent-encode"], optional = true }
derive_more = "0.99.8" derive_more = "0.99.8"
encoding_rs = "0.8" encoding_rs = "0.8"
futures-core = { version = "0.3.17", default-features = false } futures-core = { version = "0.3.17", default-features = false }

View File

@ -228,12 +228,12 @@ impl HttpResponseBuilder {
/// ///
/// let res = HttpResponse::Ok() /// let res = HttpResponse::Ok()
/// .cookie( /// .cookie(
/// Cookie::build("name", "value") /// Cookie::build(("name", "value"))
/// .domain("www.rust-lang.org") /// .domain("www.rust-lang.org")
/// .path("/") /// .path("/")
/// .secure(true) /// .secure(true)
/// .http_only(true) /// .http_only(true)
/// .finish(), /// .build(),
/// ) /// )
/// .finish(); /// .finish();
/// ``` /// ```
@ -243,10 +243,10 @@ impl HttpResponseBuilder {
/// use actix_web::{HttpResponse, cookie::Cookie}; /// use actix_web::{HttpResponse, cookie::Cookie};
/// ///
/// // the name, domain and path match the cookie created in the previous example /// // the name, domain and path match the cookie created in the previous example
/// let mut cookie = Cookie::build("name", "value-does-not-matter") /// let mut cookie = Cookie::build(("name", "value-does-not-matter"))
/// .domain("www.rust-lang.org") /// .domain("www.rust-lang.org")
/// .path("/") /// .path("/")
/// .finish(); /// .build();
/// cookie.make_removal(); /// cookie.make_removal();
/// ///
/// let res = HttpResponse::Ok() /// let res = HttpResponse::Ok()

View File

@ -776,9 +776,9 @@ async fn test_server_cookies() {
App::new().default_service(web::to(|| async { App::new().default_service(web::to(|| async {
HttpResponse::Ok() HttpResponse::Ok()
.cookie( .cookie(
Cookie::build("first", "first_value") Cookie::build(("first", "first_value"))
.http_only(true) .http_only(true)
.finish(), .build(),
) )
.cookie(Cookie::new("second", "first_value")) .cookie(Cookie::new("second", "first_value"))
.cookie(Cookie::new("second", "second_value")) .cookie(Cookie::new("second", "second_value"))
@ -791,9 +791,9 @@ async fn test_server_cookies() {
assert!(res.status().is_success()); assert!(res.status().is_success());
{ {
let first_cookie = Cookie::build("first", "first_value") let first_cookie = Cookie::build(("first", "first_value"))
.http_only(true) .http_only(true)
.finish(); .build();
let second_cookie = Cookie::new("second", "first_value"); let second_cookie = Cookie::new("second", "first_value");
let cookies = res.cookies().expect("To have cookies"); let cookies = res.cookies().expect("To have cookies");

View File

@ -98,7 +98,7 @@ serde_json = "1.0"
serde_urlencoded = "0.7" serde_urlencoded = "0.7"
tokio = { version = "1.24.2", features = ["sync"] } tokio = { version = "1.24.2", features = ["sync"] }
cookie = { version = "0.16", features = ["percent-encode"], optional = true } cookie = { version = "0.18", features = ["percent-encode"], optional = true }
tls-openssl = { package = "openssl", version = "0.10.55", optional = true } tls-openssl = { package = "openssl", version = "0.10.55", optional = true }
tls-rustls-0_20 = { package = "rustls", version = "0.20", optional = true, features = ["dangerous_configuration"] } tls-rustls-0_20 = { package = "rustls", version = "0.20", optional = true, features = ["dangerous_configuration"] }

View File

@ -110,7 +110,7 @@ mod tests {
let res = TestResponse::default() let res = TestResponse::default()
.version(Version::HTTP_2) .version(Version::HTTP_2)
.insert_header((header::DATE, HttpDate::from(SystemTime::now()))) .insert_header((header::DATE, HttpDate::from(SystemTime::now())))
.cookie(cookie::Cookie::build("name", "value").finish()) .cookie(cookie::Cookie::build(("name", "value")).build())
.finish(); .finish();
assert!(res.headers().contains_key(header::SET_COOKIE)); assert!(res.headers().contains_key(header::SET_COOKIE));
assert!(res.headers().contains_key(header::DATE)); assert!(res.headers().contains_key(header::DATE));

View File

@ -520,7 +520,7 @@ mod tests {
.protocols(["v1", "v2"]) .protocols(["v1", "v2"])
.set_header_if_none(header::CONTENT_TYPE, "json") .set_header_if_none(header::CONTENT_TYPE, "json")
.set_header_if_none(header::CONTENT_TYPE, "text") .set_header_if_none(header::CONTENT_TYPE, "text")
.cookie(Cookie::build("cookie1", "value1").finish()); .cookie(Cookie::build(("cookie1", "value1")).build());
assert_eq!( assert_eq!(
req.origin.as_ref().unwrap().to_str().unwrap(), req.origin.as_ref().unwrap().to_str().unwrap(),
"test-origin" "test-origin"

View File

@ -679,13 +679,13 @@ async fn body_streaming_implicit() {
async fn client_cookie_handling() { async fn client_cookie_handling() {
use std::io::{Error as IoError, ErrorKind}; use std::io::{Error as IoError, ErrorKind};
let cookie1 = Cookie::build("cookie1", "value1").finish(); let cookie1 = Cookie::build(("cookie1", "value1")).build();
let cookie2 = Cookie::build("cookie2", "value2") let cookie2 = Cookie::build(("cookie2", "value2"))
.domain("www.example.org") .domain("www.example.org")
.path("/") .path("/")
.secure(true) .secure(true)
.http_only(true) .http_only(true)
.finish(); .build();
// Q: are all these clones really necessary? A: Yes, possibly // Q: are all these clones really necessary? A: Yes, possibly
let cookie1b = cookie1.clone(); let cookie1b = cookie1.clone();
let cookie2b = cookie2.clone(); let cookie2b = cookie2.clone();