benoitc / hackney

simple HTTP client in Erlang
Other
1.33k stars 427 forks source link

Option for Hackney to not append library headers #529

Open yuchunc opened 6 years ago

yuchunc commented 6 years ago

Hi,

A third party API is very strict about request headers, it allows nothing but the ones documented. I’m using HTTPoison as REST client, but Hackney adds some header information, and the third party service would error. Is there some options I can set to disable this behaviour on Hackney? Or do I have to override the library module?

Thank you!

benoitc commented 6 years ago

which headers are we talking about?

benoitc commented 6 years ago

right now it's not posible. Some headers are added while performing the request:

https://github.com/benoitc/hackney/blob/master/src/hackney_request.erl#L37-L61

But an option can be added to only use user headers if needed. I would accept a patch for it. Just let me know.

yuchunc commented 6 years ago

Hi @benoitc

I started #532 PR, sorry that I submitted it without tests, my erlang skill is very limited, and I couldn't figure out how to run erlang tests. The changes in this PR is the result of fiddling with code in /deps of my elixir project.

Are there some basic steps for getting the tests running (ie. install dependencies, execute test suite)? I can add the tests if I can just have a little bit of directions. :)

Thank you!