Case sensitive header names
HTTP Header names are case insensitive, but Hackney returns a proplist of headers and the obvious way to extract a value proplists:get_value is case sensitive.
I would suggest either normalizing the case of the proplist keys before returning them, or return a hackney_headers data structure, which would encourage users to call hackney_headers:get_value(CaseInsensitiveKey, Headers, Default).
Doing this will ensure user code doesn't break if/when an HTTP intermediary changes the case of response headers (ala Amazon ELBs, Heroku's HTTP router, etc).
hrm good idea, I will take care about it in next version.
+1
+1
+1
+1
I ran into an issue when using HTTPoison, a popular Elixir client that uses Hackney, and headers from a Plug connection, which are lower-cased by default.
More info here: https://github.com/slogsdon/elixir-reverse-proxy/issues/2
i will handle that i the next release. for now you can do hackney_headers:new(Headers) to use the module hackney_headers and get and an header case insensitively.
Still seeing this issue.
@suprafly next major release may have it though why not using the hackney_headers module?
@benoitc Thanks. I found a work around, I messed around with using the hackney_headers module, however my problem with is that I am using hackney via the HTTPoison library in Elixir. It was not obvious how I could pass headers generated with that module down into hackney.