package ez_api
Source file meth.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26(**************************************************************************) (* *) (* Copyright 2018-2023 OCamlPro *) (* *) (* All rights reserved. This file is distributed under the terms of the *) (* GNU Lesser General Public License version 2.1, with the special *) (* exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) type empty = [ `OPTIONS | `HEAD ] type t = [ `GET | `POST | `PUT | `DELETE | `PATCH ] type all = [ t | empty ] let to_string : [< all ] -> string = function | `GET -> "GET" | `POST -> "POST" | `PUT -> "PUT" | `DELETE -> "DELETE" | `PATCH -> "PATCH" | `OPTIONS -> "OPTIONS" | `HEAD -> "HEAD" let headers l = let meths = String.concat "," @@ List.map to_string l in [ "access-control-allow-methods", meths ]