package quests

  1. Overview
  2. Docs

Module Quests.ResponseSource

Functions for dealing with responses from requests.

Sourcetype 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.

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

Returns whether a request has been successful.

Sourceval json : t -> Yojson.Safe.t

Parses the body of a response into JSON.

Sourceval result_for_status : t -> (t, t) result

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

OCaml

Innovation. Community. Security.