Headers sent as lowercase even if specifying http1_title_case_headers() #1996
-
Greetings, let client_builder = reqwest::Client::builder()
.connection_verbose(true) //print verbose connection info for debugging
.redirect(redirect::Policy::none())//Do not follow redirects, so that I can get the code without contacting localhost:16515/
.http1_title_case_headers(); //case-sensitive headers. See https://github.com/seanmonstar/reqwest/discussions/1895#discussioncomment-6355126
let client = client_builder.build().expect("Error building HTTPS client"); Here's how I build the first request: let request = self.client
.get(auth_endpoint_url_with_params)
.header("Shib-Spoof-Check", &self.spoof_check_secret)
.header(self.uid_field_name.clone(), uid)
.body(""); This is the first RequestBuilder serialized: RequestBuilder { method: GET, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(8080), path: "/auth", query: Some("&user=participant:bab472a1-f8b7-4397-8338-fb972e3b8280&client_id=123&redirect_uri=http://127.0.0.1:16515/&response_type=code&code_challenge=Yzc4YzUyOTE0NjM3M2E3Y2VjMmY0ZjUwMTE1MDMyYWE5MjQ1MWM1M2IxYmQ3ZGY4MTcxOWFiNzM4NTYxOTUyNA&code_challenge_method=S256"), fragment: None }, headers: {"shib-spoof-check": "be67c8dd6a141ded148861ac11aef64d68640876601a40dca01816004e4c5161", "uid": "participant:bab472a1-f8b7-4397-8338-fb972e3b8280"} } This is the second request: let request = self.client.post(token_endpoint)
.header("Shib-Spoof-Check", &self.spoof_check_secret)
.header(self.uid_field_name.clone(), uid)
.json(&request_body); And its serialization: RequestBuilder { method: POST, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(8080), path: "/token", query: None, fragment: None }, headers: {"shib-spoof-check": "be67c8dd6a141ded148861ac11aef64d68640876601a40dca01816004e4c5161", "uid": "participant:bab472a1-f8b7-4397-8338-fb972e3b8280", "content-type": "application/json"} } Note that in both cases, the "Shib-Spoof-Check" header is sent as lowercase, despite when I constructed the HTTP client I called http1_title_case_headers(). What am I getting wrong? PS: I'm using reqwest 0.11.20, cargo on my machine isn't able to find version 0.11.22 which seems to be the latest one. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The |
Beta Was this translation helpful? Give feedback.
The
Debug
output of request does not convert the case. The case is handled when written to the socket