processRequest static method
Process and parse an incoming HttpRequest.
The returned HttpRequestBody contains a response
field for accessing
the HttpResponse.
See HttpBodyHandler for more info on defaultEncoding
.
Implementation
static Future<HttpRequestBody> processRequest(HttpRequest request,
{Encoding defaultEncoding = utf8}) async {
try {
var body = await _process(request, request.headers, defaultEncoding);
return HttpRequestBody._(request, body);
} catch (e) {
// Try to send BAD_REQUEST response.
request.response.statusCode = HttpStatus.badRequest;
await request.response.close();
rethrow;
}
}