-
Notifications
You must be signed in to change notification settings - Fork 10
Status code 404 should not be used for empty lists #207
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
Comments
The postman tests will also need to be changed accordingly. |
This one I really want to get done during this sprint. Anyone that wants to fix this from @DigitalExcellence/backend ? |
This actually has to be 404 and not 204. This has been discussed multiple times last semester. This has to do that it is an API and not a website. https://developer.mozilla.org/nl/docs/Web/HTTP/Status |
Yes, it was also discussed that it was not practical to enforce this. |
Then update the issue that this has been discussed. Currently, the issue indicates that the protocol has been implemented incorrectly which is not true. I can't know when something has been discussed when it isn't described in the issue. |
Describe the bug
Error code 404 should not be used when there is nothing to return when getting a list. The 400-499 range of HTTP status codes indicate a client error. When the list of highlights is empty, it is not a client error. When the request specifies a specific ID that does not exist. The 404 Not found status code is correct.
In my opinion, status code 200 (OK) with an empty array as the body or status code 204 (No content) should be used.
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
Status code 200 OK should be returned. The body of this response can contain an (empty) array just like when there are highlights in the database.
Edit: This was discussed in a meeting with the majority of the backend developers. We decided that using 404 was not practical for our implementation.
The text was updated successfully, but these errors were encountered: