Let handlers return Context and Response
Closed this issue · 1 comments
The idea is that handlers can be used in a more pipeline like fashion if they are able to pass the context and the response on to an other handler. It would, for example, be possible to implement Handler
for Vec<H: Handler>
, and it would also allow things like error handlers.
The preliminary design is to simply add the return type Option<(Context, Response)>
to the handle_request
function. It would be great if we could keep implementing Handler
for F: Fn(Context, Response)
, but I'm afraid that's impossible until impl specializations lands. It may still be possible to implement it for fn(Context, Response)
, but the question is if it would be too surprising if it didn't work for closures.
This needs some thought, and any ideas are welcome.