add Head_middleware.trivial

This commit is contained in:
Simon Cruanes 2024-04-15 12:09:37 -04:00
parent e1368525d8
commit 241d9aeaf1
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 6 additions and 1 deletions

View file

@ -12,6 +12,7 @@ end
module Head_middleware = struct module Head_middleware = struct
type t = { handle: 'a. 'a Request.t -> 'a Request.t } 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 (self : t) req = self.handle req
let[@inline] apply' req (self : t) = self.handle req let[@inline] apply' req (self : t) = self.handle req

View file

@ -42,7 +42,11 @@ end
module Head_middleware : sig module Head_middleware : sig
type t = { handle: 'a. 'a Request.t -> 'a Request.t } type t = { handle: 'a. 'a Request.t -> 'a Request.t }
(** A handler that takes the request, without its body, (** 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 val to_middleware : t -> Middleware.t
end end