Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/cookies/header_only_response.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
select 'status_code' as component, 204 as status;
select 'cookie' as component, 'session' as name, 'abc123' as value;
10 changes: 10 additions & 0 deletions tests/cookies/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::common::req_path;
use actix_web::http::StatusCode;
use actix_web::http::header::SET_COOKIE;

async fn set_cookie_header(path: &str) -> String {
Expand Down Expand Up @@ -29,3 +30,12 @@ async fn zero_turns_off_a_cookie_protection() {
assert!(header.contains("SameSite=Lax"), "{header}");
assert!(header.contains("Path=/admin"), "{header}");
}

#[actix_web::test]
async fn a_page_made_only_of_header_components_still_sends_them() {
let resp = req_path("/tests/cookies/header_only_response.sql")
.await
.unwrap();
assert_eq!(resp.status(), StatusCode::NO_CONTENT);
assert!(resp.headers().contains_key(SET_COOKIE));
}