Using latest akka-http I want to implement an endpoint which will redirect all incoming upload file requests without consuming request entity.
Current implementation is using :
put {
extractRequest { r: HttpRequest =>
onComplete(r.discardEntityBytes().future) { done =>
redirect(Uri("http://example.com"), TemporaryRedirect)
}
}
}
The problem is that it waits until whole http request body is received (discarded) and only after that sends redirect response. From client perspective it means uploading file twice. I tried to add withSizeLimit(0)
to request entity, but it introduces early response problem.
Related documentation: