Hey! 👋
Using
MultiPartFormDataContent
to set the boy of a request in the like:
setBody(
MultiPartFormDataContent(
formData {
append("pub_id", pubId)
append("logo", logo, Headers.build {
append(HttpHeaders.ContentType, contentType)
append(HttpHeaders.ContentDisposition, "filename=\"$logoName\"")
})
}
)
)
on the server side (not Ktor) I’m getting the following:
{
fields: {
"nt-Disposition: form-data; name=pub_id\r\nContent-Length: ": "30"
},
files: {
"nt-Disposition: form-data; name=log": {
name: "nt-Disposition: form-data; name=log",
filename: "Foto May 14 2024.jpg",
contentType: "image/jpeg\r\nContent-Length: 6371508",
size: 6371508,
content: Uint8Array(6371508) [...]
}
}
}
As you can see, the Content-Disposition header is interpreted as part of the parameters and everything gets messy.
The server side is working as expected when sending the request with Postman, though.
Any idea what could be happening?
Thanks!