goadesign / plugins

A collection of plugins for Goa.
https://goa.design
MIT License
68 stars 34 forks source link

cors: always return 204 for a matched preflight #150

Closed gregwebs closed 1 year ago

gregwebs commented 1 year ago

Previously it could return a 404, etc. This had the effect of in the browser producting a network error because the preflight request failed.

These changes are passing the test suite but are not yet manually tested.

gregwebs commented 1 year ago

So this will still end up having the 404 issue because it specifically mounts to existing routes. But it will avoid other issues with a middleware returning a 401, etc.

raphael commented 1 year ago

Looks great, thank you!

gregwebs commented 1 year ago

I tested this locally and am now seeing 204 instead of 200 and it is working in the browser