Closed sgoth closed 3 months ago
You need to move writeStatus before the writeHeader
Ah ok that does work, thanks!
Still it would be nice if i could just write the CORS headers and then jump into the actual route handlers without knowing their return code in advance. But i guess it can also be done on every way out of the processing.
Is there a technical reason against a "writeHeaderOnly" function?
status comes before headers so unless you have written status, first writeHeader will
Right, sure status has to be first on the wire... Thanks for educating me and sorry for the noise :)
Its a trade off. It could be more user friendly but then it wouldn't be as simple to run
Is there a way to fulfill CORS correctly and still fail the request later on? For example encountering processing errors or input validation errors.
Calling this route from a browser results in a 200: Calling it without the CORS headers results in a fetch exception instead of an error.
Would be helpful to have a writeHeader without implicit writeStatus - or is there a reason against that?