-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
Feature request: Customize OPTIONS return code #939
Comments
Does something like: CROW_ROUTE(app, "/add_json") not work? |
will be closed as no answer to comment. |
Sorry did not have time to investigate more.
I did not try exactly the example you posted here, but I did try in a dynamic route and the handler was not called |
It seems that the http Standard prefers 200 but also allows 204. (see https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok) Currently 204 is hardcoded in routing.h. As a workaround you could patch this. As it seems that some browsers depend on it (see https://stackoverflow.com/questions/14675330/what-http-response-code-should-be-used-for-an-option-request) I would propose to add an Cmake Option "HTTP_OPTION_RESPONSE_RETURNS_OK" which defaults to off and to switch the return code based on that option. Alternatively we could switch in general to 200 but may run into issues maybe with older browsers or clients which make special assumptions. |
Hello,
I'm working on a server application whose existing (external) clients expects to have 200 on OPTIONS, and I cannot do that currently with crow.
Would it be possible to customize the return code for OPTIONS requests?
I can write the feature and send a PR, but I would like to know if this behavior is OK for you?
The text was updated successfully, but these errors were encountered: