wouterdoeland
01/13/2018, 3:08 PMroute("api") {
route("upload") {
post {
println("RECEIVED UPLOAD!")
println("COOKIES: ${call.sessions}")
AuthorisationHandler.required(call, AuthorisationHandler.AuthorisationType.LOGGED_IN)
val user = call.getUser()!!
// handle upload
PostHandler.handleContentUpload(user, call.receiveMultipart())
// everything OK, so respond with OK
call.respond(HttpStatusCode.Accepted)
}
}
}
The upload form is created here:
route("/upload") {
get {
call.respondHtml {
body {
h1 {
+"Upload content"
}
Form.UPLOAD_CONTENT.createForm(this, "/api/upload", FormEncType.multipartFormData)
}
}
}
}
Why are cookies not sent on a file upload? If I make a request to this page without an upload, cookies are set, while with an upload they are not (also not in my browser).