-
Notifications
You must be signed in to change notification settings - Fork 46
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
URI_Get_Callback should provide the HTTP status code #238
Comments
The extension actually says it should return 0 for success, and all 2xx and 3xx codes are success. This is important as QC code is expected to use != 0 to check for success in the return value. I suggest providing a way for the caller to specify how non-200 success statuses should be handled (maybe some kind of flag to enable exposing the non-2xx success status?). |
You're right. I thought it also wasn't returning the HTTP status code for 404, because other errors were just giving me a -1, but it does show a 404. A flag sounds good. |
The alternative is changing the extension to only map 200 to 0, which may be OK to do. But for that we first need to survey which other mods exist that use this, and if they would break from this. |
I think a flag that completely switches to HTTP status codes would be fine. I don't think the engine should be deciding what is a success or failure. |
When using a web API, the HTTP status code is used to indicate the state of requests. Without this status code the client can't determine what to do next, e.g., re-sending the request, or showing an error to the players.
This behaviour also differs from FTEQW which does provide the HTTP status code, e.g.:
The help text in the dpextensions.qc actually says it should be returning an HTTP code:
The text was updated successfully, but these errors were encountered: