Skip to content

Commit

Permalink
add Head_middleware.trivial
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Apr 15, 2024
1 parent e136852 commit 241d9ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ end
module Head_middleware = struct
type t = { handle: 'a. 'a Request.t -> 'a Request.t }

let trivial = { handle = Fun.id }
let[@inline] apply (self : t) req = self.handle req
let[@inline] apply' req (self : t) = self.handle req

Expand Down
6 changes: 5 additions & 1 deletion src/core/server.mli
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ end
module Head_middleware : sig
type t = { handle: 'a. 'a Request.t -> 'a Request.t }
(** A handler that takes the request, without its body,
and possibly modifies it. *)
and possibly modifies it.
@since NEXT_RELEASE *)

val trivial : t
(** Pass through *)

val to_middleware : t -> Middleware.t
end
Expand Down

0 comments on commit 241d9ae

Please sign in to comment.