-
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not set response headers when send a json body in a options request #5626
Comments
Yeah I believe you are correct, but it would be good if you could get the specific section of the spec for this so we can align on the expectations. I did a cursory search and found this which I think is the right place. It has been a long time since I have looked at these and this doc is new to me. Additionally I would say I am surprised this is broken. I don't remember any specific |
hello @yhojann-cl , can you detail what functions I'm guessing that maybe not using the function So maybe, you can try to use the function As an example:
|
|
@yhojann-cl I modified your code to be the following ( cuz I don't the values of schemafor and allowFor ): and it worked fine, without adding "res.end() or res.write()" |
@yhojann-cl I also created a test for this, and can't reproduce the error https://github.com/coltonehrman/bag-of-tools/blob/main/examples/express/headers-sent-options-request/headers.test.ts |
Setting Headers Before Sending the Response: The header is set before calling .status(200) and .json(), ensuring that the headers are all properly configured before the response is sent to the client. |
By example:
Says:
The RFC allows the return of http content for options requests. I use it to return crud data schema settings for the frontend and allowed methods for show or hide pages in the dashboard.
The text was updated successfully, but these errors were encountered: