gnarroway / hato

An HTTP client for Clojure, wrapping JDK 11's HttpClient
MIT License
380 stars 27 forks source link

Allow a header's value to be a seq of src to match clj-http and multi-valued header responses #57

Closed vincentjames501 closed 5 months ago

vincentjames501 commented 1 year ago

Right now if you receive a response with multiple values for the same header, it comes back like so:

{:headers {"content-type" "application/json"
                  "foo"          ["bar" "baz"]}}

In my opinion it's a bit inconsistent to not allow the same format for a request as well. This allows the caller to either use an array (which will send multiple header entries) or a comma separate list of values which are both acceptable per the RFC. This also is a bit more generous with the data type of the header value so you can pass something like a number which will be coerced to a string. I'm fine removing the coercion too if you feel strongly otherwise I just know I've wanted to set things like x-retry-count (number), x-user-id (uuid), etc and would be nice if it "just worked".

vincentjames501 commented 5 months ago

Ping @gnarroway , thoughts?