Library
Module
Module type
Parameter
Class
Class type
val response : t -> Response.t option
val response_exn : t -> Response.t
Responding
The following functions will initiate a response for the corresponding request in t
. When the response is fully transmitted to the wire, the stream completes.
From RFC7540§8.1: An HTTP request/response exchange fully consumes a single stream.
val respond_with_string : t -> Response.t -> string -> unit
val respond_with_bigstring : t -> Response.t -> Bigstringaf.t -> unit
val respond_with_streaming :
?flush_headers_immediately:bool ->
t ->
Response.t ->
[ `write ] Body.t
Pushing
HTTP/2 allows a server to pre-emptively send (or "push") responses (along with corresponding "promised" requests) to a client in association with a previous client-initiated request. This can be useful when the server knows the client will need to have those responses available in order to fully process the response to the original request.
push reqd request
creates a new (pushed) request descriptor that allows responding to the "promised" request. This function raises an exception if server push is not enabled for the connection.
See RFC7540§8.2 for more details.
val report_exn : t -> exn -> unit
val try_with : t -> (unit -> unit) -> (unit, exn) Result.result