sendRequest method
Send an HTTP/3 request on a new client-initiated bidirectional stream.
Encodes the request headers using QPACK, optionally writes the body as DATA frames, and stores both in the pending outbound queue. The returned stream ID uniquely identifies this request/response exchange.
The caller must flush the pending frames to the QUIC transport; this method only stages them internally.
Implementation
Future<int> sendRequest(Http3Request request) async {
final quic = _quicConnection as dynamic;
final streamId = quic.openBidirectionalStream() as int;
final headers = request.encodeHeaders(encoder: qpackEncoder);
_sendHeaders(streamId, headers);
if (request.body != null && request.body!.isNotEmpty) {
_sendData(streamId, request.body!);
}
return streamId;
}