MapFallback catch all requests to API controller when ConsumeAttribute added
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
Hello. In .net 6 behavior of MapFallback broke when ConsumesAttribute was added. MapFallback catch all requests to API controller. In .net 6 index.html file always returns on requests to API controller but if I remove endpoints.MapFallbackToFile or delete ConsumesAttribute filter then everything works as I expected. In .net 5 the example works correctly.
ConsumesAttribute was added for the correct generation of swagger.json by Swashbuckle in order not to add it to every action or controller.
Expected Behavior
Requests to controllers must not be catched by MapFallback.
Steps To Reproduce
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers(options => options.Filters.Add(new ConsumesAttribute("application/json")));
}
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapFallbackToFile("index.html");
});
}
}
Exceptions (if any)
No response
.NET Version
6.0.200
Anything else?
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:14 (12 by maintainers)
Top Results From Across the Web
How to map fallback in ASP .NET Core Web API so that ...
Now I want to change it so that the Blazor WASM app only responds to requests from https://localhost:44331 and not requests to https://localhost ......
Read more >FallbackEndpointRouteBuilderEx...
Adds a specialized RouteEndpoint to the IEndpointRouteBuilder that will match requests for non-file-names with the lowest possible priority.
Read more >ASP.NET Core Web API - How to Handle GET Request
Every web API controller class inherits from the ControllerBase abstract class that provides all the necessary behavior for the derived class.
Read more >Building a URL Shortener Web App using Minimal APIs in . ...
This API has to cover lots of input variations, thus the easiest way to catch all URLs is to use the MapFallback() method....
Read more >Post in ASP.NET Core REST API
In this video we will discuss, how to create a new item, i.e implement http post in ASP.NET Core REST API. To create...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for contacting us. We’re moving this issue to the
.NET 7 Planning
milestone for future evaluation / consideration. Because it’s not immediately obvious that this is a bug in our framework, we would like to keep this around to collect more feedback, which can later help us determine the impact of it. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it’s very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.@davidfowl absolutely.
@MackinnonBuck can you take care of it?