-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
UmbracoApiController routing does not work if the route is the same for POST and GET requests #16434
Comments
Hi there @lommijuho! Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better. We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
I can reproduce it on both v13.4.1, v14.1.1, v12 and does not happen on v11. |
Hi @lommijuho .. After looking into this, it seems like a unintended side-effect, that has occurred since the introduction of the delivery api and especially the API versioning dependency (like you found). In the example you give, where you only have a If you do not have this I'm afraid the only real solution to this, is to report it on thier repository, as the same happens on plain asp.net core controllers. I think the smoking gun is this code https://github.com/dotnet/aspnet-api-versioning/blob/main/src/AspNetCore/WebApi/src/Asp.Versioning.Http/Routing/ApiVersionMatcherPolicy.cs#L403-L405 |
I have created an minimal setup issue on the dependency's repository: dotnet/aspnet-api-versioning#1101 |
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
13.2.2
Bug summary
When I upgraded from U10.5.1 to U13.2.2 I faced an issue that broke my UmbracoApiController routing. When I make a GET request to an endpoint that shares the route with a POST endpoint, the GET request returns a 404. If I use unique routes for each request method, everything seems to be working correctly.
Specifics
No response
Steps to reproduce
Create a fresh Umbraco project and add 2 controllers with the same route but different methods e.g.:
Making a POST request works, but GET request request returns 404.
I was able to follow the issue and found out that
ApiVersionMatcherPolicy.ApplyAsync()
scores both of my endpoint candidates to a negative value and therefore makes both of them invalid. I'm not sure if this is the real issue but this could somehow be related to the problem. When removingApiVersionMatcherPolicy
from builder.Services, both endpoints worked correctly.Expected result / actual result
I assume that in this situation both endpoints should work normally, because the request method is different.
This item has been added to our backlog AB#42384
The text was updated successfully, but these errors were encountered: