I tried to upload an image to the server with ktor...
# ktor
p
I tried to upload an image to the server with ktor-client. But it lacks
Content-Length
. May I know how can I put it in please?
j
Note: the MultiPartFormDataContent from ktor should also support calculating contentLength
to go around this you can create your own subclass for Outgoing.WriteChannelContent like this: https://gist.github.com/jonasbark/3a0054dcf0c8ac9a896a0d805574914c please note calculating contentLength probably has bad performance
p
Thanks! I saw your changes in the latest ktor client lib. Does that mean that
MultiPartFormDataContent
cannot calculate
contentLength
yet?
j
Exactly. Can you open a ticket for this? I think it's an important thing that's missing at the moment :)
👍 1