Reputation: 37
I'm trying to handle the requests that don't belong to any defined endpoints in my project and run some logic before sending the 404 response.
For example, if I have two functions (http trigger) with routes /api/function1/{id} and /api/function2/{name} then I want to do something if the user sends a request to /whatever - like changing the reason phrase or adding a string content in the response like "Url does not exist". Is this even possible with AF?
Upvotes: 0
Views: 214
Reputation: 29939
Is this even possible with AF?
No.
In ASP.NET Core, middleware is what does all the clever things behind the scenes like allowing you to register a global exception handler for specific HTTP status codes. Azure Functions currently has no concept of middleware, so that sort of functionality simply isn't possible.
Upvotes: 1