Skip to content
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

Fix DB fetching on not found entries #271

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

Dany9966
Copy link
Contributor

Whenever a GET call to a non-existent object is requested, the server would not return a proper 404 code response. Instead, it returned a 500, because .to_dict() was called upon the not found object directly (which should be None). This patch makes sure that .to_dict() is only called upon existing DB models, and as a result, it will return a 404 response on not found objects.

Whenever a GET call to a non-existent object is requested, the server would
not return a proper `404` code response. Instead, it returned a `500`, because
`.to_dict()` was called upon the not found object directly (which should be
`None`). This patch makes sure that `.to_dict()` is only called upon existing
DB models, and as a result, it will return a `404` response on not found
objects.
@Dany9966 Dany9966 merged commit ad580f0 into cloudbase:master Nov 7, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant