Skip to content

Commit

Permalink
add a HEAD endpoint to echo
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Dec 25, 2024
1 parent 1318d46 commit a86eac8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/echo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ let () =
Route.(exact "alice" @/ return)
(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 *)
Tiny_httpd.Dir.add_vfs server
~config:
Expand Down

0 comments on commit a86eac8

Please sign in to comment.