RutledgePaulV / clj-okhttp

MIT License
4 stars 1 forks source link

Mime type of request RequestBody when content is a string should likely not be application/octet-stream #8

Open vincentjames501 opened 2 years ago

vincentjames501 commented 2 years ago

It's pretty much always set to application/octet-stream which makes a lot of sense for byte-arrays, files, inputstreams, etc. But for Strings, we should consider following what is done in clj-http?

https://github.com/dakrone/clj-http/blob/3.x/src/clj_http/multipart.clj#L101

Rewriting ->request-body to be a defmulti would be nice too as it would allow people to extend the library more easily to support custom types.

RutledgePaulV commented 2 years ago

Agreed about the multimethod for ->request-body

I don't like to assume a content-type of text/plain just because someone handed me a string. The truth is I don't know what's in it, and the best I can honestly tell the server is "here are some bytes". The caller needs to set a content-type header if they want to tell the server something more specific.

vincentjames501 commented 2 years ago

@RutledgePaulV , I fixed this in #9