Closed artemevsin closed 6 years ago
Hi, interesting idea. The OPTIONS
request is just for sure, it's allowed, right?
It would be better to handle it for all endpoints in different layer, instead of @AllowOptionsMethod
annotation. Because, it's the same as your conditions, but you know, in annotations. ;-)
Fastest way ATM:
I've been thinking about middleware and it will be good enough for my purpose. I'm too lazy to write conditions :smile:
Thank you for great job! :+1:
;-)
@f3l1x
what if OPTIONS
methods were generated automatically?
Hi, my current use case: JS app sends POST request and axios sends preflight OPTIONS request. So I have to annotate every class method, that handles POST with
@Method({"POST", "OPTIONS"})
and in case it's OPTIONS request I send empty response like that:I can imagine, that not all requests should be handled with CORS (not really sure, if there is any real use case), so it can be usefull to use
@AllowOptionsMethod
annotation that will send response to these requests automatically.What do you think about it?