package terminus

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

A Mock backend is an implementation of the S module with a mock backend.

type 'a io = 'a

The I/O monad used to execute HTTP request.

val return : 'a -> 'a io

return x creates a value in the io monad.

val map : ('a -> 'b) -> 'a io -> 'b io

map f x executes the f function and then wrap the result in the io monad.

val bind : ('a -> 'b io) -> 'a io -> 'b io

bind f x is the same as map but the function f should handle the binding into the io monad.

val fail : [ `Msg of string ] -> 'a io

fail err is the equivalent of return but with a failure in the io monad.

val get : headers:(string * string) list -> url:string -> string io

get ~headers ~url executes a request to the server as a GET call and, returns the result as a string.

val post : headers:(string * string) list -> url:string -> string -> string io

post ~headers ~url body executes a request to the server as a POST call using body to describe the request. It returns the result as a string.

val put : headers:(string * string) list -> url:string -> string -> string io

put ~headers ~url body executes a request to the server as a PUT call using body to describe the request. It returns the result as a string.

val delete : headers:(string * string) list -> url:string -> string io

delete ~headers ~url executes a request to the server as a DELETE call and returns the result as a string.

OCaml

Innovation. Community. Security.