Http3Response class
An HTTP/3 response with status code, headers, and optional body.
Represents a single HTTP/3 response message as defined in RFC 9114.
The :status pseudo-header is extracted during decoding and exposed as
the integer statusCode. Regular headers are stored in headers with
lower-cased keys. An optional binary body may be attached for responses
that carry payload.
Http3Response objects are typically obtained via Http3Connection.getResponse after the peer has sent HEADERS and DATA frames on a request stream.
Example
final response = Http3Response(
statusCode: 200,
headers: {
'content-type': 'text/html',
'cache-control': 'no-cache',
},
body: Uint8List.fromList(utf8.encode('<h1>Hello</h1>')),
);
final encoded = response.encodeHeaders();
See also:
- Http3Connection.getResponse — retrieves a response for a given stream.
- Http3Request — the corresponding request type.
- RFC 9114 Section 4.1 — HTTP/3 Response Stream.
Constructors
Properties
- body → Uint8List?
-
The optional response body.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
Regular HTTP response headers.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- statusCode → int
-
The HTTP status code (e.g.
200,404,500).final
Methods
-
encodeHeaders(
{QpackEncoder? encoder}) → Uint8List - Encode the response 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, {QpackDecoder? decoder}) → Http3Response - Decode a QPACK-encoded field section into an Http3Response.