Made the HTTP headers handling more flexible.

- Pass in an associative array of headers keyed by header field name with the header field values as the values.
- Specifically allow the Content-Type HTTP header to be overridden.