Lee Griffiths
03/07/2025, 1:37 PMwhen (val contentType = call.request.contentType()) {
ContentType.Application.Json -> {
call.receive<etc>()
}
ContentType.MultiPart.FormData -> {
etc.decode(call.receiveMultipart())
}
else -> {
call.respond(HttpStatusCode.BadRequest, "ContentType not supported: $contentType")
return@post
}
}
It's hitting the else case, with the content type being multipart/form-data; boundary=----geckoformboundary72272ecba2803550f625913948b580af
How am I meant to properly detect if it's multipart or not?Aleksei Tirman [JB]
03/07/2025, 1:49 PMContent-Type
without parameters to make one of the conditions succeed:
post {
when (call.request.contentType().withoutParameters()) {
ContentType.MultiPart.FormData -> {
println("Form data")
}
}
}
Lee Griffiths
03/07/2025, 1:57 PM