I have the CORS feature enabled. I'm finding that if I don't have:
[Route("/cors_endpoint", "GET, OPTIONS")]
on my request dto, then I get a 404.
As I'm using the CorsFeature
, and the PreRequestFilter
below, I don't understand where this 404 is coming. (I also have authentication attributes in play, but am doing stateless auth with it).
Plugins.Add(new CorsFeature());
PreRequestFilters.Add((req, res) => {
if (req.Method == "OPTIONS")
{
res.StatusCode = 200; //my hack
res.EndRequest();
}
});
Any ideas? PS. Still on 3.9.x
Edit: My real questions maybe should be:
[Route("/cors_endpoint", "GET")]
This gives a 404, and doesn't hit the PreRequestFilter at all. Why?