Fork me on GitHub

Hello, is it possible to receive a request with content-type application/octet-stream and read its body directly as a byte-array? When I perform the request, I receive an HTTPInputOverHttp. I see it is an InputStream and maybe I can convert it in an interceptor, but it seems that it would be possible to receive it directly as a stream (I might be wrong though)


(defn get-handler
  [{:keys [^InputStream body]}]
  (let [byte-array (.toByteArray  (with-open [baos (ByteArrayOutputStream.)]
                                    (.transferTo body baos)
Something like that. In JVM8, you can use (io/copy body baos)