I want to accept options requests from an angular website. Every endpoint (signup, login etc) needs to accept the options http verb.
I will then add the following to the response header.
After += ctx =>
{
ctx.Response.WithHeader("Access-Control-Allow-Origin", "*");
ctx.Response.WithHeader("Access-Control-Allow-Headers", "accept, client-token, content-type");
ctx.Response.WithHeader("Access-Control-Allow-Methods", "POST, GET");
ctx.Response.WithHeader("Access-Control-Max-Age", "30758400");
};
What i dont want to do is add an extra route for every endpoint like
Post[path + "Login"] = x => Login();
Options[path + "Login"] = x => Login();
This would be masses of boilerplate code.
Is there a way i can intercept any options request using a wildcard route so that all my endpoints can accept options requests?