Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cookie dependency to 0.18 #3336

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions actix-web/CHANGES.md
Expand Up @@ -9,6 +9,7 @@
### Changed

- Minimum supported Rust version (MSRV) is now 1.72.
- Updated `cookie` dependency to `0.18`.

## 4.5.1

Expand Down
2 changes: 1 addition & 1 deletion actix-web/Cargo.toml
Expand Up @@ -99,7 +99,7 @@ ahash = "0.8"
bytes = "1"
bytestring = "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"
encoding_rs = "0.8"
futures-core = { version = "0.3.17", default-features = false }
Expand Down
8 changes: 4 additions & 4 deletions actix-web/src/response/builder.rs
Expand Up @@ -228,12 +228,12 @@ impl HttpResponseBuilder {
///
/// let res = HttpResponse::Ok()
/// .cookie(
/// Cookie::build("name", "value")
/// Cookie::build(("name", "value"))
/// .domain("www.rust-lang.org")
/// .path("/")
/// .secure(true)
/// .http_only(true)
/// .finish(),
/// .build(),
/// )
/// .finish();
/// ```
Expand All @@ -243,10 +243,10 @@ impl HttpResponseBuilder {
/// use actix_web::{HttpResponse, cookie::Cookie};
///
/// // 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")
/// .path("/")
/// .finish();
/// .build();
/// cookie.make_removal();
///
/// let res = HttpResponse::Ok()
Expand Down
8 changes: 4 additions & 4 deletions actix-web/tests/test_server.rs
Expand Up @@ -776,9 +776,9 @@ async fn test_server_cookies() {
App::new().default_service(web::to(|| async {
HttpResponse::Ok()
.cookie(
Cookie::build("first", "first_value")
Cookie::build(("first", "first_value"))
.http_only(true)
.finish(),
.build(),
)
.cookie(Cookie::new("second", "first_value"))
.cookie(Cookie::new("second", "second_value"))
Expand All @@ -791,9 +791,9 @@ async fn test_server_cookies() {
assert!(res.status().is_success());

{
let first_cookie = Cookie::build("first", "first_value")
let first_cookie = Cookie::build(("first", "first_value"))
.http_only(true)
.finish();
.build();
let second_cookie = Cookie::new("second", "first_value");

let cookies = res.cookies().expect("To have cookies");
Expand Down
1 change: 1 addition & 0 deletions awc/CHANGES.md
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Minimum supported Rust version (MSRV) is now 1.72.
- Update `cookie` dependency to `0.18`.

## 3.4.0

Expand Down
2 changes: 1 addition & 1 deletion awc/Cargo.toml
Expand Up @@ -98,7 +98,7 @@ serde_json = "1.0"
serde_urlencoded = "0.7"
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-rustls-0_20 = { package = "rustls", version = "0.20", optional = true, features = ["dangerous_configuration"] }
Expand Down
2 changes: 1 addition & 1 deletion awc/src/test.rs
Expand Up @@ -110,7 +110,7 @@ mod tests {
let res = TestResponse::default()
.version(Version::HTTP_2)
.insert_header((header::DATE, HttpDate::from(SystemTime::now())))
.cookie(cookie::Cookie::build("name", "value").finish())
.cookie(cookie::Cookie::build(("name", "value")).build())
.finish();
assert!(res.headers().contains_key(header::SET_COOKIE));
assert!(res.headers().contains_key(header::DATE));
Expand Down
2 changes: 1 addition & 1 deletion awc/src/ws.rs
Expand Up @@ -520,7 +520,7 @@ mod tests {
.protocols(["v1", "v2"])
.set_header_if_none(header::CONTENT_TYPE, "json")
.set_header_if_none(header::CONTENT_TYPE, "text")
.cookie(Cookie::build("cookie1", "value1").finish());
.cookie(Cookie::build(("cookie1", "value1")).build());
assert_eq!(
req.origin.as_ref().unwrap().to_str().unwrap(),
"test-origin"
Expand Down
6 changes: 3 additions & 3 deletions awc/tests/test_client.rs
Expand Up @@ -679,13 +679,13 @@ async fn body_streaming_implicit() {
async fn client_cookie_handling() {
use std::io::{Error as IoError, ErrorKind};

let cookie1 = Cookie::build("cookie1", "value1").finish();
let cookie2 = Cookie::build("cookie2", "value2")
let cookie1 = Cookie::build(("cookie1", "value1")).build();
let cookie2 = Cookie::build(("cookie2", "value2"))
.domain("www.example.org")
.path("/")
.secure(true)
.http_only(true)
.finish();
.build();
// Q: are all these clones really necessary? A: Yes, possibly
let cookie1b = cookie1.clone();
let cookie2b = cookie2.clone();
Expand Down