Open
Description
As part of the recent work to add better form support for minimal APIs, we've needed to add logic in the endpoint routing middleware to ensure that certain metadata is able to configure HTTP features before other middlewares run. The routing middleware is convenient here because it is the earliest point wherein we can set these features before other middleware can run.
While form support and anti-forgery are strong motivating examples, the general model of being able to run "filters" during routing is helpful enough that we should consider provide a more generic API for this.