babashka/http-client

When using a string key for Accept header, the value is overridden by the default

Closed this issue · 3 comments

In this case, from the README example, the Accept header is prefixed with */*.

With

(http/get "https://httpstat.us/200" {:headers {"Accept" "application/json"}})

the actual accept header value is sent as */*,application/json.

As a workaround, this works fine:

(http/get "https://httpstat.us/200" {:headers {:accept "application/json"}})

the accept header is now application/json.

The only difference in the two examples is the use of the keyword :accept rather than the string "Accept".

Ah right:

user=> babashka.http-client/default-client-opts
{:follow-redirects :normal, :request {:headers {:accept "*/*", :accept-encoding ["gzip" "deflate"], :user-agent "babashka.http-client/0.4.14"}}}

Something more clever needs to happen with respect to merging/overriding default options.

@malcolmsparks Fixed on main, need another release?

Released as 0.4.15