From 9c2cf0900daf1d73239cfa49bcb1a2cdc835d4d4 Mon Sep 17 00:00:00 2001 From: Stephane Legrand Date: Sun, 7 May 2023 15:58:43 +0200 Subject: [PATCH] Add OPTIONS method --- src/Tiny_httpd_server.ml | 3 +++ src/Tiny_httpd_server.mli | 1 + 2 files changed, 4 insertions(+) diff --git a/src/Tiny_httpd_server.ml b/src/Tiny_httpd_server.ml index 218272df..ba797118 100644 --- a/src/Tiny_httpd_server.ml +++ b/src/Tiny_httpd_server.ml @@ -64,6 +64,7 @@ module Meth = struct | `POST | `HEAD | `DELETE + | `OPTIONS ] let to_string = function @@ -72,6 +73,7 @@ module Meth = struct | `HEAD -> "HEAD" | `POST -> "POST" | `DELETE -> "DELETE" + | `OPTIONS -> "OPTIONS" let pp out s = Format.pp_print_string out (to_string s) let of_string = function @@ -80,6 +82,7 @@ module Meth = struct | "POST" -> `POST | "HEAD" -> `HEAD | "DELETE" -> `DELETE + | "OPTIONS" -> `OPTIONS | s -> bad_reqf 400 "unknown method %S" s end diff --git a/src/Tiny_httpd_server.mli b/src/Tiny_httpd_server.mli index 075e14f7..9f41c376 100644 --- a/src/Tiny_httpd_server.mli +++ b/src/Tiny_httpd_server.mli @@ -21,6 +21,7 @@ module Meth : sig | `POST | `HEAD | `DELETE + | `OPTIONS ] (** A HTTP method. For now we only handle a subset of these.