Change how the HTTP Headers dict is built

It looks nicer this way.
Refactor unit tests