request property

  1. @Deprecated('Use methods to get info about a request; not the request itself')
HttpRequest get request

Returns the underlying HttpRequest.

This member should not be used unless absolutely necessary. Please use method, requestPath, connectionInfo, certificate, headers, cookies, bodyBytes, bodyStr or bodyStream to obtain information about the request.

It is only available 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('Use methods to get info about a request; not the request itself')
HttpRequest get request {
  final _cr = _coreRequest;
  if (_cr is _CoreRequestReal) {
    return _cr._httpRequest;
  } else {
    throw UnsupportedError('request not available on simulated Requests');
  }
}