Skip to content

Commit a86eac8

Browse files
committed
add a HEAD endpoint to echo
1 parent 1318d46 commit a86eac8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/echo.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ let () =
244244
Route.(exact "alice" @/ return)
245245
(fun _req -> Response.make_string (Ok alice_text));
246246

247+
Server.add_route_handler ~meth:`HEAD server
248+
Route.(exact "head" @/ return)
249+
(fun _req ->
250+
Response.make_void ~code:200 ~headers:[ "x-hello", "world" ] ());
251+
247252
(* VFS *)
248253
Tiny_httpd.Dir.add_vfs server
249254
~config:

0 commit comments

Comments
 (0)