My agentic slop goes here. Not intended for anyone else!
at main 1.8 kB view raw
1(** HTTP methods following RFC 7231 *) 2 3(** Log source for method operations *) 4val src : Logs.Src.t 5 6(** HTTP method type using polymorphic variants for better composability *) 7type t = [ 8 | `GET (** Retrieve a resource *) 9 | `POST (** Submit data to be processed *) 10 | `PUT (** Replace a resource *) 11 | `DELETE (** Delete a resource *) 12 | `HEAD (** Retrieve headers only *) 13 | `OPTIONS (** Retrieve allowed methods *) 14 | `PATCH (** Partial resource modification *) 15 | `CONNECT (** Establish tunnel to server *) 16 | `TRACE (** Echo received request *) 17 | `Other of string (** Non-standard or extension method *) 18] 19 20(** {1 Conversion Functions} *) 21 22val to_string : t -> string 23(** Convert method to uppercase string representation *) 24 25val of_string : string -> t 26(** Parse method from string (case-insensitive). 27 Returns [`Other s] for unrecognized methods. *) 28 29val pp : Format.formatter -> t -> unit 30(** Pretty printer for methods *) 31 32(** {1 Method Properties} *) 33 34val is_safe : t -> bool 35(** Returns true for safe methods (GET, HEAD, OPTIONS, TRACE). 36 Safe methods should not have side effects. *) 37 38val is_idempotent : t -> bool 39(** Returns true for idempotent methods (GET, HEAD, PUT, DELETE, OPTIONS, TRACE). 40 Idempotent methods can be called multiple times with the same result. *) 41 42val has_request_body : t -> bool 43(** Returns true for methods that typically have a request body (POST, PUT, PATCH) *) 44 45val is_cacheable : t -> bool 46(** Returns true for methods whose responses are cacheable by default (GET, HEAD, POST). 47 Note: POST is only cacheable with explicit cache headers. *) 48 49(** {1 Comparison} *) 50 51val equal : t -> t -> bool 52(** Compare two methods for equality *) 53 54val compare : t -> t -> int 55(** Compare two methods for ordering *)