I have an Azure Function with 3 endpoints:
When I call the "Search" endpoint, then it hits the "anything" route (number 3) while I would expect it to first hit the static routes and only if they are not matched, then it would hit the route with the wildcard.
When I call the "Analyze" endpoint then it works as expected. Here is a screenshot showing my test.

What exactly determines which endpoint is hit in the route? How do I troubleshoot this?
(I tried many things to confirm the issue, such as removing query parameters and renaming endpoints to something obscure)
Edit
The solution by @hury-shen worked - by changing the method name the alphabetically sorted matching changed and actually affected which path was hit. I am describing it here in addition to his fully satisfactory answer, so I can include a screenshot showing how it looks when solved.

According to some test, it seems the system will check the sequence of the functions and then match the endpoint. In your function app, the function Search comes after the function GetImage. So it will match the endpoint of GetImage first but not match the endpoint of Search.
To solve this problem, I didn't find a way which can set the priority. But we can change the function name easily to meet your requirement. Just change the name of function GetImage from GetImage to ZGetImage, then it will comes after function Search.
Jsut add a letter Z, it will not change the old path of your functions(as mentioned in your comments).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With