Esc

accept_http2_exchange

procedureextensionexperimentalsince 0.36.1Source
  • macOS: accept_http2_exchange works on macOS
  • Linux: accept_http2_exchange works on Linux
  • Windows: accept_http2_exchange works on Windows
  • Wasm: accept_http2_exchange works on Wasm

Starts an HTTP/2 response from a handler, returning a duplex stream. The handler must complete its work before returning; no second ordinary response is sent. Request fields remain borrowed until close_exchange; response fields are copied. defer_headers permits replacement before the first write/finish commits them.

Signature

accept_http2_exchange :: (
    request: *Request,
    headers: [] Header_Field,
    status := 200,
    defer_headers := false
) -> (Http2_Exchange, bool)
Example
exchange, ok := accept_http2_exchange(request, Header_Field.[.{ name = "content-type", value = "application/grpc" }]);
defer close_exchange(*exchange);

See also