Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preserving case of HTTP headers with curl

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?

like image 642
Phil Avatar asked Jan 07 '19 02:01

Phil


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"
like image 176
Phil Avatar answered Sep 23 '22 16:09

Phil