-
Notifications
You must be signed in to change notification settings - Fork 107
Description
What I expect
Xh copies case of user-specified headers.
What actually happens
Xh treats all headers as case-insensitive and lowercases them.
Why is this a problem?
- It's a difference from httpie.
- It has a negative net effect when interacting with non-compliant servers.
To explain 2...
Some services treat headers as case-sensitive (e.g with X-*
headers, especially for auth).
The HTTP specification does specify that headers are case-insensitive, however, consider the following matrix.
If headers are treated as case insensitive, this will break servers that (incorrectly) treat them as case-sensitive, while not having a negative effect on compliant servers.
If headers are treated as case sensitive, this will work with the non-compliant servers, while not having a negative effect on compliant servers.
It would also be ok to auto-capitalize headers (e.g foO-baR-baZ
could become Foo-Bar-Baz
), since that's what standard industry practice anyway, but this is not what HTTPie does.
How to test compliance
xh --print=H localhost My-OdDlY-Capitalized-Header:Here
compare to
http --print=H localhost My-OdDlY-Capitalized-Header:Here