from static method
Magically transforms an HttpRequest into a RequestContext.
Implementation
static Future<HttpRequestContext> from(
HttpRequest request, Angel app, String path) {
var ctx = HttpRequestContext().._container = app.container.createChild();
var override = request.method;
if (app.allowMethodOverrides == true) {
override =
request.headers.value('x-http-method-override')?.toUpperCase() ??
request.method;
}
ctx.app = app;
ctx._contentType = request.headers.contentType == null
? MediaType('text', 'plain')
: MediaType.parse(request.headers.contentType.toString());
ctx._override = override;
ctx._path = path;
ctx._io = request;
return Future.value(ctx);
}