Options for Httpoison and Hackney to not append library headers?

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 it’s underlying library, 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 default module?

Thank you!

1 Like

I just looked through the source code for hackney and there doesn’t seem to be any kind of toggle you could set to stop the default headers from being added - I think it would be a beneficial feature if you’d be willing to add it in the spirit of open source :slight_smile:.

For sure! But I have never written any erlang, probably need to fumble with it for a bit.

Hi @hazardfn

I got a PR going to add an option to disable library headers, it’s the result of fiddling with code in /deps. I have very little experience with erlang, and can’t seem to figure out how to get the test suite to run. If it is not too much trouble, can you take a look at the PR, and point me in some general direction on how to properly test it?

Thank you!

I have left some comments on the PR, I can’t speak to benoitc’s personal tastes regarding formatting etc but I offered some pointers of how I’d have laid it out.

The big thing is there may be an unintentional side-effect in your PR that you should investigate and be sure isn’t going to cause problems :). More details in the PR.

1 Like