requestedUri property

  1. @override
Uri requestedUri
override

The requested URI for the request.

If the request URI is absolute (e.g. 'https://www.example.com/foo') then it is returned as-is. Otherwise, the returned URI is reconstructed by using the request URI path (e.g. '/foo') and HTTP header fields.

To reconstruct the scheme, the 'X-Forwarded-Proto' header is used. If it is not present then the socket type of the connection is used i.e. if the connection is made through a SecureSocket then the scheme is 'https', otherwise it is 'http'.

To reconstruct the host, the 'X-Forwarded-Host' header is used. If it is not present then the 'Host' header is used. If neither is present then the host name of the server is used.

Implementation

@override
Uri get requestedUri {
  if (_requestedUri != null) {
    return _requestedUri!;
  } else {
    return _requestedUri = Uri(
      scheme: 'http',
      host: 'example.com',
      path: uri.path,
      query: uri.query,
    );
  }
}
void requestedUri=(Uri value)

Implementation

set requestedUri(Uri value) {
  _requestedUri = value;
}