complete meth.t

This commit is contained in:
zapashcanon 2024-01-11 23:37:22 +01:00
parent 59eb6f3825
commit ced8cc9ac8
Signed by untrusted user who does not match committer: zapashcanon
GPG Key ID: 8981C3C62D1D28F1
3 changed files with 31 additions and 8 deletions

View File

@ -1,3 +1,21 @@
type t =
| Connect
| Delete
| Get
| Head
| Options
| Post
| Put
| Trace
| Other of string
let of_httpcats = function
| `CONNECT -> Connect
| `DELETE -> Delete
| `GET -> Get
| `HEAD -> Head
| `OPTIONS -> Options
| `POST -> Post
| `PUT -> Put
| `TRACE -> Trace
| `Other s -> Other s

12
src/meth.mli Normal file
View File

@ -0,0 +1,12 @@
type t =
| Connect
| Delete
| Get
| Head
| Options
| Post
| Put
| Trace
| Other of string
val of_httpcats : H2.Method.t -> t

View File

@ -60,12 +60,5 @@ let of_httpcats
in
let route = Uri.path target |> Route.of_string in
let headers = H2.Headers.to_list headers in
let meth =
match meth with
| `GET -> Meth.Get
| `POST -> Meth.Post
| _ ->
(* TODO: complete this *)
assert false
in
let meth = Meth.of_httpcats meth in
{ route; meth; query; headers }