Collect streaming request bodies (#23)
Fixes #22.
Request bodies of a certain size come in streaming and the properties
return `nil`. We should check this and perform a check similar to what
Vapor's routing tools do internally:
1d53c99b6e/Sources/Vapor/Routing/RoutesBuilder%2BMethod.swift (L152)
This commit is contained in:
parent
876da8b61f
commit
ae1db2ec96
|
@ -32,6 +32,11 @@ where Router.Input == URLRequestData {
|
|||
chainingTo next: AsyncResponder
|
||||
) async throws -> Response {
|
||||
|
||||
if request.body.data == nil {
|
||||
try await _ = request.body.collect(max: request.application.routes.defaultMaxBodySize.value)
|
||||
.get()
|
||||
}
|
||||
|
||||
guard let requestData = URLRequestData(request: request)
|
||||
else { return try await next.respond(to: request) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue