package quests

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Functions for dealing with responses from requests.

type t = {
  1. content : string;
  2. status_code : int;
  3. headers : Cohttp.Header.t;
  4. request : Request.t;
}

The response from a request. The request field contains details about the actual request sent (for instance, it includes headers added by Quests, and the URL will have a query string with any supplied parameters.

val pp : Stdlib.Format.formatter -> t -> unit
val show : t -> string
val content : t -> string
val status_code : t -> int
val headers : t -> Cohttp.Header.t
val ok : t -> bool

Returns whether a request has been successful.

val json : t -> Yojson.Safe.t

Parses the body of a response into JSON.

val result_for_status : t -> (t, t) Stdlib.result

Creates a result from the response depending on whether it was successful.

OCaml

Innovation. Community. Security.