HTTP headers are case insensitive
This StackOverflow answer cites the RFC which defines headers.
Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive.
This means that if I send an HTTP request with the header "accept: text/html"
(note the lowercase A
), it will be translated to "Accept: text/html"
.
In practical terms, this means in my Go code I must do Headers["Accept"]
, where the Headers
map is an attribute on a http.Request
.
Strangely, AWS API Gateway seems to do it the other way around, where “normal” headers such as Accept
are lowercased into accept
.
I discovered this while trying to use the header in a Lambda function.