request property

HttpRequest request

Returns the HttpRequest.

This member should not be used unless absolutely necessary. It is now deprecated: please use method, requestPath, headers, cookies, bodyBytes, bodyStr to obtain information that was previously obtained from the Request's request member.

It is only implemented for Request objects from real HTTP requests, and will throw an UnsupportedError exception when called on a simulated Request. Therefore, using it will prevent the server from being tested using Server.simulate.

If a value is required from HttpRequest, consider submitting an issue to have it exposed by Request in a manner that allows it to be used for both real and simulated HTTP requests.

Implementation

@deprecated
HttpRequest get request {
  if (_coreRequest is _CoreRequestReal) {
    // ignore: avoid_as
    return (_coreRequest as _CoreRequestReal)._httpRequest;
  } else {
    throw new UnsupportedError('request not available on simulated Requests');
  }
}