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

Support response generators for the endpoint results #1342

Merged
merged 5 commits into from
Jul 19, 2023

Conversation

brockallen
Copy link
Member

This PR introduces the IEndpointResultGenerator<T> type which is designed to render the IEndpointResult objects that are returned from the IEndpointHandler in our endpoint routing architecture.

Previously the IEndpointResult would render themselves, but was difficult for customers to override or change how they did this. Now our built in IEndpointResult classes use a new base class EndpointResult which will resolve a IEndpointResultGenerator<T> from DI to do the rendering. This allows customers to register their own IEndpointResultGenerator<T> and can change how they are rendered to the HTTP response.

This PR is also designed to be backwards compatible with the prior approach, such that any custom IEndpointResult or IEndpointHandler should still work the way they used to.

Closes: #1129

Replaces: #1330

@brockallen brockallen added enhancement New feature or request needs_docs labels Jun 26, 2023
@brockallen brockallen added this to the 7.0 milestone Jun 26, 2023
@brockallen
Copy link
Member Author

Updated for [re-]review @josephdecock

@brockallen brockallen merged commit 029c763 into main Jul 19, 2023
5 checks passed
@brockallen brockallen deleted the brock/result-generators-2 branch July 19, 2023 16:35
@josephdecock josephdecock mentioned this pull request Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider result generator in DI for our result objects
2 participants