Skip to content

Commit

Permalink
ocamlformat my changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pkel committed Mar 22, 2021
1 parent 98baec5 commit b044e32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions opium/src/middlewares/middleware_static_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ open Lwt.Syntax
let default_etag ~local_path fname =
let fpath = Filename.concat local_path fname in
let* exists = Lwt_unix.file_exists fpath in
if exists then
if exists
then
let* stat = Lwt_unix.stat fpath in
let hash =
Marshal.to_string stat.st_mtime []
Expand All @@ -13,11 +14,10 @@ let default_etag ~local_path fname =
|> Base64.encode_exn
in
Lwt.return_some hash
else
Lwt.return_none
else Lwt.return_none
;;

let m ~local_path ?uri_prefix ?headers ?(etag_of_fname=default_etag ~local_path) () =
let m ~local_path ?uri_prefix ?headers ?(etag_of_fname = default_etag ~local_path) () =
let read fname =
let* body = Body.of_file (Filename.concat local_path fname) in
match body with
Expand Down
4 changes: 2 additions & 2 deletions opium/src/opium.mli
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ module Middleware : sig
The behaviour of the middleware is similar to {!static}, since the latter is used
with a [read] function that reads from the local filesystem. Unlike {!static}, this
middleware supplies a default [etag_of_fname] which derives an appropriate ETag
from the last modification timestamp of the served file. *)
middleware supplies a default [etag_of_fname] which derives an appropriate ETag from
the last modification timestamp of the served file. *)
val static_unix
: local_path:string
-> ?uri_prefix:string
Expand Down

0 comments on commit b044e32

Please sign in to comment.