#hyper::client::Client working example w/ http1_preserve_header_case & nativeTls
16 messages · Page 1 of 1 (latest)
That seems very specific. Could you just adapt the hyper-tls example code to your needs?
Instead of HttpsConnector::new() use HttpsConnector::from((HttpConnector::new(), tls.into())), where tls is one of these https://docs.rs/native-tls/latest/native_tls/struct.TlsConnector.html configured with the PEM cert
You need to call this function to add a root cert https://docs.rs/native-tls/latest/native_tls/struct.TlsConnectorBuilder.html#method.add_root_certificate
https://docs.rs/native-tls/latest/native_tls/struct.Certificate.html#method.from_pem and here is the function to make one from PEM
thank you! I saw all the pieces but wasn't sure how to put them together. I'll give that a try. FWIW, I actually had native-tls from a PEM working w/ reqwest but then I discovered that the legacy system restful service that I needed to send requests used case sensitive matches for HTTP header keys instead of insensitive per the standard, so then I discovered that reqwest did NOT support (please correct me if I'm wrong) hyper::client::Builder:: http1_preserve_header_case(), so I'm having to refactor to use hyper instead.
You have this https://docs.rs/reqwest/latest/reqwest/struct.ClientBuilder.html#method.http1_title_case_headers
A ClientBuilder can be used to create a Client with custom configuration.
Hmm...not sure how I missed that! I guess I asked the wrong question, but MANY THANKS for the quick answers! Cheers!
unfortunately, after further review, the legacy system service uses camel case for HTTP header keys and not title case so reqwest::ClientBuilder::http1_title_case_headers() isn't going to work and reqwest doesn't expose http1_preserve_header_case() as far as I can tell, so back to plan B and use your hyper solution above. Thanks!
