Fork me on GitHub
#aleph
<
2017-12-05
>
jfntn04:12:35

aleph.http.encoding> (encode-base64 "val")
ClassCastException java.nio.HeapByteBuffer cannot be cast to io.netty.buffer.ByteBuf  aleph.http.encoding/encode-base64 (form-init3445602468191842931.clj:34)

jfntn04:12:41

Am I missing something here?

jfntn05:12:17

I’m unable to reproduce a working curl multipart upload:

curl -X POST  -F "[email protected]" "http://..."
With aleph’s http client I have:
(http.client/request
 {:url            "http://..."
  :request-method :post
  :multipart      [{:part-name "file"
                    :name      "foo.jpg"
                    :mime-type "image/jpeg"
                    :content   (io/file (io/resource "foo.jpg"))}]})
The request goes through but the server is not reading the data correctly, I inspected the requests with Postman and realized the Content-Length header is completely different, as well as the encoding. That’s when I ran into the ClassCastException trying to set the :transfer-encoding to :base64 on the part.

jfntn14:12:04

^cc @kachayev — sorry for the ping but I noticed you contributed that feature

kachayev15:12:12

@jfntn I’m not sure it’s enough information for me to troubleshoot this

kachayev15:12:32

Would you please DM me entire request/response?

jfntn15:12:42

@kachayev can do in 30 min, commuting now

jfntn15:12:10

FYI tried clj-http and it works with the same params