package terminus

  1. Overview
  2. Docs
Module type
Class type
type query =
  1. | Get of string
  2. | Post of string * string
  3. | Put of string * string
  4. | Delete of string

The query type defines the interaction with the API:

  • Get path: tries to execute the GET method on a specific path in the API
  • Post (path, expected) defines a POST method on a path and verify the input with expected.
  • Put (path, expected) works the same way as Post
  • Delete path executes a DELETE method on a specific path
exception Wrong_url of string

Exception raised when you are trying to execute a request on a wrong url or when urls mismatched.

exception Wrong_header of string

Exception raised when on field in an header mismatch.

module type Mock_backend = sig ... end

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

val mock : address:string -> expected_headers:(string * string) list -> expect:(query * string) list -> unit -> (module Mock_backend)

mock ~address ~expected_headers ~expect () creates a new mock backend with some checks in it. The address is the endpoint for the API. the expected_headers are the data that should be found at each request in the header. expect is a list of query with the answer expected when you execute the request.