style: fix example

This commit is contained in:
Simon Cruanes 2020-03-25 23:03:51 -04:00
parent 53cf1fbde0
commit 64df8616f9

View file

@ -23,17 +23,17 @@ let () =
in in
let ic = open_in path in let ic = open_in path in
let str = S.Byte_stream.of_chan ic in let str = S.Byte_stream.of_chan ic in
let mime_type = let mime_type =
try try
let p = Unix.open_process_in (Printf.sprintf "file -i -b %S" path) in let p = Unix.open_process_in (Printf.sprintf "file -i -b %S" path) in
try try
let s = ["Content-Type", String.trim (input_line p)] in let s = ["Content-Type", String.trim (input_line p)] in
ignore @@ Unix.close_process_in p; ignore @@ Unix.close_process_in p;
s s
with _ -> ignore @@ Unix.close_process_in p; [] with _ -> ignore @@ Unix.close_process_in p; []
with _ -> [] with _ -> []
in in
S.Response.make_stream ~headers:mime_type (Ok str) S.Response.make_stream ~headers:mime_type (Ok str)
); );
(* echo request *) (* echo request *)
S.add_path_handler server S.add_path_handler server