Http3Request class

An HTTP/3 request with pseudo-headers, regular headers, and optional body.

Represents a single HTTP/3 request message as defined in RFC 9114. Pseudo-headers (:method, :path, :scheme, :authority) are automatically generated during encoding; callers supply the HTTP method, path, regular headers, and an optional binary body.

Http3Request objects are passed to Http3Connection.sendRequest, which QPACK-encodes the headers and stages the request on a new QUIC stream.

Example

final request = Http3Request(
  method: 'POST',
  path: '/api/data',
  headers: {
    'host': 'example.com',
    'content-type': 'application/json',
  },
  body: Uint8List.fromList(utf8.encode('{"key":"value"}')),
);
final encoded = request.encodeHeaders();

See also:

Constructors

Http3Request({required String method, required String path, Map<String, String> headers = const {}, Uint8List? body})
Creates an HTTP/3 request.

Properties

body Uint8List?
The optional request body.
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
Regular HTTP headers (excluding pseudo-headers).
final
method String
The HTTP method (e.g. 'GET', 'POST', 'PUT').
final
path String
The request target path (e.g. '/index.html').
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

encodeHeaders({QpackEncoder? encoder}) Uint8List
Encode the request headers as a QPACK-encoded field section.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

decodeHeaders(Uint8List bytes) Http3Request
Decode a QPACK-encoded field section into an Http3Request.