aleph

jfntn 2017-12-05T04:37:35.000108Z

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)

jfntn 2017-12-05T04:37:41.000149Z

Am I missing something here?

jfntn 2017-12-05T05:35:17.000145Z

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

curl -X POST  -F "file=@foo.jpg" "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.

jfntn 2017-12-05T14:39:04.000348Z

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

kachayev 2017-12-05T15:00:12.000348Z

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

kachayev 2017-12-05T15:00:32.000151Z

Would you please DM me entire request/response?

jfntn 2017-12-05T15:04:42.000469Z

@kachayev can do in 30 min, commuting now

jfntn 2017-12-05T15:05:10.000732Z

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