RutledgePaulV / clj-okhttp

MIT License
4 stars 1 forks source link

Consider supporting `:content-type` and `:accept` request keys #13

Closed vincentjames501 closed 2 years ago

vincentjames501 commented 2 years ago

This could help with automatic coercion of :body params for example similar to what clj-http does when submitting something like :content-type :json

RutledgePaulV commented 2 years ago

clj-okhttp considers the "Content-Type" header of the request when encoding the body. I think it's a mistake to support the option in two different places (though I realize it would provide better compatibility with clj-http). Similarly, if you want to set an accept header, why not just set a "Accept" header.

vincentjames501 commented 2 years ago

@RutledgePaulV , I think that's fair and I agree (though it's a bit more painful to type):

(http/post "feh" {:content-type :json :accept :json :body {}})

vs

(http/post "feh" {:headers {"content-type" "application/json; charset=utf-8;" 
                                            "accept" "application/json; charset=utf-8;" 
                            :body {}})

I'll close this.