From b3ffbe4b5088eb3e2f38afa409c755320d384af0 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 19 Dec 2024 16:27:11 -0800 Subject: [PATCH] submissions-api: fix cookie --- validation/api/src/context.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/validation/api/src/context.rs b/validation/api/src/context.rs index 7e128f4..3d7e74c 100644 --- a/validation/api/src/context.rs +++ b/validation/api/src/context.rs @@ -1,8 +1,9 @@ pub struct Cookie(reqwest::header::HeaderValue); impl Cookie{ + /// cookie is prepended with "session_id=" by this function pub fn new(cookie:&str)->Result{ - Ok(Self(reqwest::header::HeaderValue::from_str(&cookie)?)) + Ok(Self(reqwest::header::HeaderValue::from_str(&format!("session_id={}",cookie))?)) } } @@ -19,9 +20,10 @@ impl Context{ base_url, client:{ let mut builder=reqwest::ClientBuilder::new(); - if let Some(cookie)=cookie{ + if let Some(mut cookie)=cookie{ + cookie.0.set_sensitive(true); let mut headers=reqwest::header::HeaderMap::new(); - headers.insert("session_id",cookie.0); + headers.insert("Cookie",cookie.0); builder=builder.default_headers(headers); } builder.build()?