Request class
An HTTP request to be processed by a Relic Server application.
Constructors
-
Request.new(RequestMethod method, Uri requestedUri, {HttpConnectionInfo? connectionInfo, String? protocolVersion, Headers? headers, String? handlerPath, Uri? url, Body? body, Map<
String, Object> ? context, HijackHandler? onHijack}) - Creates a new Request.
- Request.fromHttpRequest(HttpRequest request, {bool strictHeaders = false, String? poweredByHeader})
-
Creates a new Request from an io.HttpRequest.
factory
Properties
- body ↔ Body
-
The streaming body of the message.
getter/setter pairinherited
- canHijack → bool
-
Whether this request can be hijacked.
no setter
- connectionInfo → HttpConnectionInfo?
-
The HttpConnectionInfo info associated with this request, if available.
final
-
context
→ Map<
String, Object> -
Extra context for middleware and handlers.
finalinherited
- encoding → Encoding?
-
Returns the encoding specified in the Body-Type (Content-Type header), or null if not specified.
no setterinherited
- handlerPath → String
-
The URL path to the current handler.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- headers → Headers
-
The HTTP headers associated with this message.
finalinherited
- isEmpty → bool
-
Determines if the body is empty by checking the content length.
no setterinherited
- isHijacked → bool
-
Whether this request has been hijacked.
no setter
- method → RequestMethod
-
The HTTP request method, such as "GET" or "POST".
final
- mimeType → MimeType?
-
Returns the MIME type from the Body-Type (Content-Type header), if available.
no setterinherited
- protocolVersion → String
-
The HTTP protocol version used in the request, either "1.0" or "1.1".
final
- requestedUri → Uri
-
The original Uri for the request.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- url → Uri
-
The URL path from the current handler to the requested resource, relative
to handlerPath, plus any query parameters.
final
Methods
-
copyWith(
{Headers? headers, Uri? requestedUri, Map< String, Object?> ? context, String? path, Body? body}) → Request - Creates a new Request by copying existing values and applying specified changes.
-
hijack(
HijackCallback callback) → Never - Takes control of the underlying request socket.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
) → Stream< Uint8List> -
Reads the body as a stream of bytes. Can only be called once.
inherited
-
readAsString(
[Encoding? encoding]) → Future< String> -
Reads the body as a string, decoding it using the specified or detected encoding.
Defaults to utf8 if no encoding is provided or detected.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited