request method
Converts HttpRequest to Request
.
Implementation
Request request(HttpRequest request) {
final converted = Request(request.method, request.uri);
final body = request.body;
if (body.isNotEmpty) {
// The Request would set the content-type header if the body is assigned
// a value (even an empty string).
// See https://github.com/dart-lang/http/issues/841
converted.body = body;
}
converted.headers.addAll(request.headers);
return converted;
}