123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960(* This file is part of Dream, released under the MIT license. See LICENSE.md
for details, or visit https://github.com/aantron/dream.
Copyright 2021 Anton Bachin *)(* See also:
- SEARCH, https://tools.ietf.org/html/draft-snell-search-method-02
- Other WebDAV methods: COPY, LOCK, MKCOL, MOVE, PROPFIND, PROPPATCH,
UNLOCK. *)typemethod_=[|`GET|`POST|`PUT|`DELETE|`HEAD|`CONNECT|`OPTIONS|`TRACE|`PATCH|`Methodofstring]letmethod_to_string=function|`GET->"GET"|`POST->"POST"|`PUT->"PUT"|`DELETE->"DELETE"|`HEAD->"HEAD"|`CONNECT->"CONNECT"|`OPTIONS->"OPTIONS"|`TRACE->"TRACE"|`PATCH->"PATCH"|`Methodmethod_->method_letstring_to_method=function|"GET"->`GET|"POST"->`POST|"PUT"->`PUT|"DELETE"->`DELETE|"HEAD"->`HEAD|"CONNECT"->`CONNECT|"OPTIONS"->`OPTIONS|"TRACE"->`TRACE|"PATCH"->`PATCH|method_->`Methodmethod_(* TODO Test this. *)(* TODO Technically, this does one allocation in case the string can't be
converted to a variant, which can be saved by inlining string_to_method.
However, this is probably extremely rare. *)letnormalize_method=function|`Methodmethod_->string_to_methodmethod_|method_->method_letmethods_equalmethod_1method_2=normalize_methodmethod_1=normalize_methodmethod_2