Skip to content
Merged
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: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ rustls = "0.23"
rustls-pemfile = "2"
scraper = "0.24.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.149"
serde_json = { version = "1.0.149", features = ["raw_value"] }
serde_yaml_ng = "0.10"
sha2 = "0.10.9"
similar = "2.7"
Expand Down
32 changes: 32 additions & 0 deletions crates/trusted-server-adapter-fastly/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2297,6 +2297,38 @@ mod tests {
.eid_sync_source()
}

#[test]
fn auction_route_carries_the_raw_ts_eids_cookie_to_finalization() {
let router = test_router();
let eids_cookie = base64::engine::general_purpose::STANDARD.encode(
serde_json::json!([{ "source": "ids.example.com", "uids": [{ "id": "example-uid" }] }])
.to_string(),
);
let mut request = browser_request(Method::POST, "/auction", "empty");
request.headers_mut().insert(
header::COOKIE,
HeaderValue::from_str(&format!("ts-eids={eids_cookie}"))
.expect("should build cookie header"),
);

let response = route(&router, request);

let state = response
.extensions()
.get::<super::EcFinalizeState>()
.expect("auction responses should carry EC finalization state");
assert_eq!(
state.eids_cookie.as_deref(),
Some(eids_cookie.as_str()),
"the adapter should hand finalization the raw ts-eids cookie"
);
assert_eq!(
state.ec_context.eid_sync_source(),
Some(EidSyncSource::Auction),
"finalization should know this was an /auction request"
);
}

#[test]
fn dispatch_limits_returning_user_eid_sync_to_eligible_routes() {
let router = test_router();
Expand Down
Loading
Loading