spierce7
08/12/2022, 8:07 PMspierce7
08/12/2022, 8:07 PMval contentLength: Long = call.request.header(HttpHeaders.ContentLength)
?.toLongOrNull()
?.let { if (it <= BYTES_3_MB) it else null }
?: run {
call.respond(HttpStatusCode.BadRequest)
return@post
}
Aleksei Tirman [JB]
08/16/2022, 9:52 AMContent-Length
header you can accumulate number of bytes read while receiving a request body to verify that it doesn’t exceeds a limit.