Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] allow middleware to transform a response #592

Open
ghost opened this issue Nov 17, 2020 · 0 comments
Open

[feature] allow middleware to transform a response #592

ghost opened this issue Nov 17, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Nov 17, 2020

description

i think kemal should allow middleware to transform responses from routes in addition to transforming requests. it would add a fair bit of power to be able to throw a specific exception in a route and have a middleware catch that exception and return a certain error page

usecases:

  • validate in the route, throw a ValidationError, which the middleware catches and responds with an HTTP 400
  • transform the response body with additional content or processing
  • move certain common processing from routes to middleware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant