"400 Bad Request The HTTP request did not have a Host header", but I added it manually #1895
-
Greetings, I'm building a client inside a class specifying the let client_builder=reqwest::Client::builder()
.connection_verbose(true); //print verbose connection info for debugging
let client= client_builder.build().expect("Error building HTTPS client"); Then I'm making the following request: let request = self.client
.get(auth_endpoint_url_with_params)
.header("Host", host_with_port) //let's be compliant to the HTTP specs
.header("Shib-Spoof-Check", spoof_check_secret)
.header(self.uid_field_name.clone(), uid)
.body("")
.send()
.await?; But I'm getting the following error as output:
I get the error about the missing header regardless of whether I add
In the GTP95 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
reqwest add the host header automatically, too. You can see it in the verbose output. It could be that the server (wrongly) depends on a specific capitalization of the name. If so, you can enable |
Beta Was this translation helpful? Give feedback.
reqwest add the host header automatically, too. You can see it in the verbose output.
It could be that the server (wrongly) depends on a specific capitalization of the name. If so, you can enable
ClientBuilder::http1_title_case_headers()
option.