fetch icon indicating copy to clipboard operation
fetch copied to clipboard

Unable to access raw body stream from fetch response

Open knubie opened this issue 1 year ago • 1 comments

In js/fetch you can access the raw body as a stream like so:

(let [res (<p! (js/fetch endpoint #js{...}))]
  (-> res .-body (.pipe dest)))

However, similar to #25, in lambdaisland/fetch it's not possible to access the raw body because it's always decoded first.

https://github.com/lambdaisland/fetch/blob/1fe9fab75b47f5a245dfa105a87ffe8da539118d/src/lambdaisland/fetch.cljs#L115

knubie avatar Apr 12 '24 22:04 knubie

decode-body is a multimethod, we should add a no-op :raw option, so you can make a request :as :raw. A pr for that would be welcome.

plexus avatar Apr 13 '24 06:04 plexus