Module Http.Method

Methods and method constraints.

Methods

type t = [
  1. | `GET
    (*

    GET

    *)
  2. | `HEAD
    (*

    HEAD

    *)
  3. | `POST
    (*

    POST

    *)
  4. | `PUT
    (*

    PUT

    *)
  5. | `DELETE
    (*

    DELETE

    *)
  6. | `CONNECT
  7. | `OPTIONS
  8. | `TRACE
    (*

    TRACE

    *)
  9. | `PATCH
    (*

    PATCH '

    *)
  10. | `Other of string
    (*

    Other token

    *)
]

The type for request methods.

val decode : string -> (t, string) Stdlib.result

decode s decodes a method from s.

val encode : t -> string

encode m encodes m to a method.

val pp : Stdlib.Format.formatter -> t -> unit

pp formats methods for inspection.

Constraints

type 'a constraint' = t * 'a

The type for constraining methods to 'a.

val constrain : allowed:'a constraint' list -> t -> ('a, 'a constraint' list) Stdlib.result

constrain ~allowed m constrains m to allowed. This is Ok m if m is constrained by allowed and Error allowed otherwise.

val connect : [> `CONNECT ] constraint'

connect adds `CONNECT to the constraint set.

val delete : [> `DELETE ] constraint'

delete adds `DELETE to the constraint set.

val get : [> `GET ] constraint'

get adds `GET to the constraint set.

val head : [> `HEAD ] constraint'

head adds `HEAD to the constraint set.

val options : [> `OPTIONS ] constraint'

options adds `OPTIONS to the constraint set.

val other : string -> 'a -> 'a constraint'

other s v adds a constraint for method s represented by v to the constraint set.

val patch : [> `PATCH ] constraint'

patch adds `PATCH to the constraint set.

val post : [> `POST ] constraint'

post adds `POST to the constraint set.

val put : [> `PUT ] constraint'

put adds `PUT to the constraint set.

val trace : [> `TRACE ] constraint'

trace adds `TRACE to the constraint set.