Preserving case of HTTP headers with curl

Viewed 5001

I'm trying to use curl to send a HTTP request with custom headers (curl http://example.com -H "Foo: bar"), and I'm finding that when the header arrives, it has been lower-cased, by curl (the above Foo header is received as foo: bar)

How to preserve the case of headers in a request?

1 Answers

Try forcing curl to use HTTP/1.1 - it defaults to HTTP/2, the spec for which states that headers must be in lower case.

curl http://example.com --http1.1 -H "Foo: bar"
Related