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:

Constructors

Http3Response({required int statusCode, Map<String, String> headers = const {}, Uint8List? body})
Creates an HTTP/3 response.

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.