cljs-http icon indicating copy to clipboard operation
cljs-http copied to clipboard

Added .setResponseType handling

Open juskrey opened this issue 11 years ago • 5 comments

Suitable for e.g. arraybuffers requests. Takes standard values, as in goog.net.XhrIo.ResponseType Example:

(http/get "http://example.com/some-binary-api" 
                              {:with-credentials? false 
                               :response-type "arraybuffer"})

Defaults to ""

In the returned map, adds :response-type key, which returns (.getResponseType target) for response consistency checking and :response, which returns (.getResponse target), the proper way of handling non-default request types.

juskrey avatar Sep 16 '14 05:09 juskrey

+1

teropa avatar Mar 29 '15 19:03 teropa

Any chance this pull request gets merged? Thank you.

danskarda avatar Jun 02 '15 23:06 danskarda

@danskarda I agree that we should return the response under the :body key in this case as well. Updated patch with tests welcome!

Also, is this only working in Webkit?

http://closure-library.googlecode.com/git-history/docs/class_goog_net_XhrIo.html

r0man avatar Jun 03 '15 07:06 r0man

I'll look into it, considering the new updates (plus the comment about optional :body).

juskrey avatar Jun 03 '15 12:06 juskrey

Definitely should be added, I'm downloading torrent files and need a binary option. Have to switch to cljs-ajax for now.

edbond avatar Jul 29 '15 21:07 edbond