benoitc/hackney — pull request #117 by omarkj (2014-08-12 00:49:44+00:00)
Title: Don't overwrite the `Host` header if passed in

Hackney [recently](https://github.com/benoitc/hackney/commit/9b246c1445f310457cbf199dac80c9966b05c16e) started making sure that the `Host` header is always set when making a request. This is the correct behaviour according to the [`HTTP/1.1`](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23) spec.

The bug introduced with this feature is that user-supplied `Host` headers are overwritten by the Hackney with the host extracted from the URI. This isn't always what the user wants to do, for example in test cases.

This commit checks for the `Host` header and adds it if it is missing. If one is already present the header will not longer be replaced and the user-supplied `Host` header will be used.