bogdanfinn / tls-client

net/http.Client like HTTP Client with options to select specific client TLS Fingerprints to use for requests.
BSD 4-Clause "Original" or "Old" License
665 stars 132 forks source link

[Bug]: Automatically making some headers in title case #101

Open 64chevy opened 4 months ago

64chevy commented 4 months ago

TLS client version

1.2

System information

MacOS + Linux

Issue description

The code automatically makes the cookie, content-length, content-type, traceparent headers into title case and I receive 400 error from an api because we have to send the headers in lowercase. Please keep the original formatting of headers.

Steps to reproduce / Code Sample

Sending request to many apis is marked as bad request (error 400) because of automatic title casing.

bogdanfinn commented 4 months ago

@staz9 https://bogdanfinn.gitbook.io/open-source-oasis/tls-client/request-headers#header-key-capitalization

The client will change your header keys to title case when you are providing them all lowercase but using http1. Make sure to use http2 when sending all lowercase header keys

AlexPaiva commented 4 months ago

@staz9 https://bogdanfinn.gitbook.io/open-source-oasis/tls-client/request-headers#header-key-capitalization

The client will change your header keys to title case when you are providing them all lowercase but using http1. Make sure to use http2 when sending all lowercase header keys

Any way to force http2?

bogdanfinn commented 4 months ago

@AlexPaiva it depends on the client profile and the server. It will automatically prefer http2 if your client and the server both supports it.