Module H2.Status
Response Status Codes
The status-code element is a three-digit integer code giving the result of the attempt to understand and satisfy the request.
See RFC7231§6 for more details.
This module is a strict superset of Httpaf.Status. Even though the HTTP/2 specification removes support for the Switching_protocols status code, h2 keeps it for the sake of higher level interaction between OCaml libraries that support both HTTP/1 and HTTP/2.
See RFC7540§8.1.1 for more details.
include module type of Httpaf.Status with type Status.client_error := Httpaf.Status.client_error and type Status.standard := Httpaf.Status.standard and type Status.t := Httpaf.Status.t
type informational=[|`Continue|`Switching_protocols]type successful=[|`Accepted|`Created|`No_content|`Non_authoritative_information|`OK|`Partial_content|`Reset_content]type redirection=[|`Found|`Moved_permanently|`Multiple_choices|`Not_modified|`See_other|`Temporary_redirect|`Use_proxy]type server_error=[|`Bad_gateway|`Gateway_timeout|`Http_version_not_supported|`Internal_server_error|`Not_implemented|`Service_unavailable]
val default_reason_phrase : Httpaf.Status.standard -> stringval to_code : Httpaf.Status.t -> intval of_code : int -> Httpaf.Status.tval unsafe_of_code : int -> Httpaf.Status.tval is_informational : Httpaf.Status.t -> boolval is_successful : Httpaf.Status.t -> boolval is_redirection : Httpaf.Status.t -> boolval is_client_error : Httpaf.Status.t -> boolval is_server_error : Httpaf.Status.t -> boolval is_error : Httpaf.Status.t -> boolval to_string : Httpaf.Status.t -> stringval of_string : string -> Httpaf.Status.tval pp_hum : Stdlib.Format.formatter -> Httpaf.Status.t -> unit
type client_error=[|Httpaf.Status.client_error|`Misdirected_request]The 4xx (Client Error) class of status code indicates that the client seems to have erred.
See RFC7231§6.5 for more details.
In addition to http/af, this type also includes the 421 (Misdirected Request) tag. See RFC7540§9.1.2 for more details.
type standard=[|Httpaf.Status.standard|client_error]The status codes defined in the HTTP/1.1 RFCs, excluding the
Switching Protocolsstatus and including theMisdirected Requestas per the HTTP/2 RFC.See RFC7540§8.1.1 and RFC7540§9.1.2 for more details.
type t=[|standard|`Code of int]The standard codes along with support for custom codes.
val default_reason_phrase : standard -> stringdefault_reason_phrase standardis the example reason phrase provided by RFC7231 for thestandardstatus code. The RFC allows servers to use reason phrases besides these in responses.
val to_code : t -> intto_code tis the integer representation oft.
val of_code : int -> tof_code iis thetrepresentation ofi.of_coderaisesFailureifiis not a positive three-digit number.
val unsafe_of_code : int -> tunsafe_of_code iis equivalent toof_code i, except it accepts any positive code, regardless of the number of digits it has. On negative codes, it will still raiseFailure.
val is_informational : t -> boolis_informational tistrueifftbelongs to the Informational class of status codes.
val is_successful : t -> boolis_successful tistrueifftbelongs to the Successful class of status codes.
val is_redirection : t -> boolis_redirection tistrueifftbelongs to the Redirection class of status codes.
val is_client_error : t -> boolis_client_error tistrueifftbelongs to the Client Error class of status codes.
val is_server_error : t -> boolis_server_error tistrueifftbelongs to the Server Error class of status codes.
val is_error : t -> boolis_server_error tistrueifftbelongs to the Client Error or Server Error class of status codes.