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

Binary response data gets mangled

Open wiseman opened this issue 5 years ago • 2 comments

When I do a GET of, e.g., a JPEG, it seems that the :body of the response gets mangled when it is converted to a string. How do I get access to the raw binary of the response body?

wiseman avatar Apr 29 '19 20:04 wiseman

To get a raw binary body, add :response-type :array-buffer to the request options. Alternative keywords include:

:array-buffer XhrIo.ResponseType.ARRAY_BUFFER :blob XhrIo.ResponseType.BLOB :document XhrIo.ResponseType.DOCUMENT :text XhrIo.ResponseType.TEXT :default XhrIo.ResponseType.DEFAULT

njordhov avatar May 12 '19 06:05 njordhov

Added How to Fetch Binary Data to the wiki.

njordhov avatar May 15 '19 22:05 njordhov