Module Fetch.Response

Request responses.

Enumerations

module Type : sig ... end

Response type enum.

Responses

type init

The type for response initialisation objects.

val init : ?headers:Headers.t -> ?status:int -> ?status_text:Jstr.t -> unit -> init

init () is a response initialisation object with given parameters.

type t

The type for Response objects.

val v : ?init:init -> ?body:Body.init -> unit -> t

v ~init ~body is a response with parameters init and body body.

val of_response : t -> t

of_response r is a copy of r.

val error : unit -> t
val redirect : ?status:int -> Jstr.t -> t

redirect ~status url is a redirect response to url with status status.

val as_body : t -> Body.t

as_body r is the body interface of r.

Properties

val headers : t -> Headers.t

headers r are the headers of r.

val ok : t -> bool

ok r is true if the response r is successful.

val redirected : t -> bool

redirected r is true if the reponse is the result of a redirection.

val status : t -> int

status r is the status of r.

val status_text : t -> Jstr.t

status_text r is the status text of r.

val url : t -> Jstr.t

url r is the url of r.