RequestData.fromHttpRequest constructor

RequestData.fromHttpRequest(
  1. Request request
)

Implementation

factory RequestData.fromHttpRequest(Request request) {
  var params = Map<String, String>();
  request.url.queryParameters.forEach((key, value) {
    params[key] = value;
  });
  String baseUrl = request.url.origin + request.url.path;
  return RequestData(
    method: methodFromString(request.method),
    encoding: request.encoding,
    body: request.body,
    baseUrl: baseUrl,
    headers: request.headers,
    params: params,
  );
}