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

Inject something between route definition and final return? (Response-middleware) #622

Open
esbenboye opened this issue Aug 29, 2022 · 0 comments

Comments

@esbenboye
Copy link

Brief elaboration on my use case(s):

When running my unit tests (environment = testing) it would be an advantage if I could return an entire response object from my controller, so I could analyse response headers (e.g. status code) and content.

When running in any other environment I would want my response to just return the rendered html without having to modify all my controller to have an if/else to check environment.

I also think it could be advantageous if I could just return a model from my controller and then have the "response middleware" check if the request accepted json or xml and then do the appropriate conversion, so I don't have to think about it in the controller.

Is this possible somehow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant