Module H2.Response

Response

A server-generated message to a Request.t.

type t = {
  1. status : Status.t;
  2. headers : Headers.t;
}
val create : ?headers:Headers.t -> Status.t -> t

create ?headers status creates an HTTP response with the given parameters. Unlike the Response type in http/af, h2 does not define a way for responses to carry reason phrases or protocol version.

See RFC7540§8.1.2.4 for more details.

val body_length : request_method:Method.standard -> t -> [ `Error of [ `Bad_request ] | `Fixed of int64 | `Unknown ]

body_length ~request_method t is the length of the message body accompanying t assuming it is a response to a request whose method was request_method.

See RFC7230§3.3.3 for more details.

val pp_hum : Format.formatter -> t -> unit