-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When configuring the endpoints using app.Map everything works as expected. But when the endpoints belong to a controller that is configured with app.UseEndpoints() the cache does not ignore one of the paths to the controller.
I am using a call to UseEndpoints to configure a controller with two methods, both of which have the OutputCache attribute set to a preconfigured policy based on a dynamic condition (in this case it just checks the URL. My real case scenario is somewhat different and checks for a flag in the HttpContext.Items collection).
Here are the tested URLS (test app is attached):
// expected to be cached, works, uses app.Map
/TimeCached
// expected to be not cached, works, uses app.Map
/TimeNotCached
// expected to be cached, works, uses app.UseEndpoints()
/Home/TimeCached
// expected not to be cached, does not work , uses app.UseEndpoints()
/Home/TimeNotCached
Expected Behavior
I would expect that the call to app.UseEndpoints() would behave the same way as app.Map() and respectively cache and not cache depending on a dynamic condition within the configured policy.
Steps To Reproduce
Just run the code sample and browse the following URLS:
// expected to be cached, works, uses app.Map
/TimeCached
// expected to be not cached, works, uses app.Map
/TimeNotCached
// expected to be cached, works, uses app.UseEndpoints()
/Home/TimeCached
// expected not to be cached, does not work , uses app.UseEndpoints()
/Home/TimeNotCached
Exceptions (if any)
No response
.NET Version
7.0.100-rc.2.22477.23