add a HEAD endpoint to echo

This commit is contained in:
Simon Cruanes 2024-12-25 10:59:32 -05:00
parent 1318d46efa
commit a86eac85bf
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -244,6 +244,11 @@ let () =
Route.(exact "alice" @/ return) Route.(exact "alice" @/ return)
(fun _req -> Response.make_string (Ok alice_text)); (fun _req -> Response.make_string (Ok alice_text));
Server.add_route_handler ~meth:`HEAD server
Route.(exact "head" @/ return)
(fun _req ->
Response.make_void ~code:200 ~headers:[ "x-hello", "world" ] ());
(* VFS *) (* VFS *)
Tiny_httpd.Dir.add_vfs server Tiny_httpd.Dir.add_vfs server
~config: ~config: