Closed craff closed 7 months ago
Yes, accept
predates middlewares, it's a bit redundant. However it's also simpler to use for basic cases, I think.
Middlewares can already look at the request first, or modify the response last. They can't modify the response first because it simply doesn't exist before the inner layer returns a response. An example of middleware that modifies both request and response is the camlzip middleware. How it works: the middleware takes handler
and req
and resp
(a continuation that will eat the response); it can modify req
before passing it to handler
if needed; it can intercept the response from the handler before passing it to resp
.
Composition operators on middlewares is clearly a possibility, but the question is: what more than the list do you need? Choice? I'm open to the idea but I think it'd be good to have concrete examples of use cases.
I think the overlap is fine for now.