opium

OCaml web framework
IN THIS PACKAGE
Module Opium . Method
type standard = [
| `GET(*

RFC7231§4.3.1. Safe, Cacheable.

*)
| `HEAD(*

RFC7231§4.3.2. Safe, Cacheable.

*)
| `POST(*

RFC7231§4.3.3. Cacheable.

*)
| `PUT(*

RFC7231§4.3.4. Idempotent.

*)
| `DELETE(*

RFC7231§4.3.5. Idempotent.

*)
| `CONNECT(*

RFC7231§4.3.6.

*)
| `OPTIONS(*

RFC7231§4.3.7. Safe.

*)
| `TRACE(*

RFC7231§4.3.8. Safe.

*)
]
type t = [
| standard
| `Other of string(*

Methods defined outside of RFC7231, or custom methods.

*)
]
val is_safe : standard -> bool

Request methods are considered "safe" if their defined semantics are essentially read-only; i.e., the client does not request, and does not expect, any state change on the origin server as a result of applying a safe method to a target resource. Likewise, reasonable use of a safe method is not expected to cause any harm, loss of property, or unusual burden on the origin server.

See RFC7231§4.2.1 for more details.

val is_cacheable : standard -> bool

Request methods can be defined as "cacheable" to indicate that responses to them are allowed to be stored for future reuse.

See RFC7234 for more details.

val is_idempotent : standard -> bool

A request method is considered "idempotent" if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request. Of the request methods defined by this specification, PUT, DELETE, and safe request methods are idempotent.

See RFC7231§4.2.2 for more details.

Utilities

val to_string : t -> string

to_string t returns a string representation of the method t.

val of_string : string -> t

of_string s returns a method from its string representation s.

val sexp_of_t : t -> Sexplib0.Sexp.t

sexp_of_t t converts the request t to an s-expression

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

pp formats the request t as an s-expression