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

Make use of http.HTTPStatus for response status code checks #1487

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

ulgens
Copy link
Collaborator

@ulgens ulgens commented Dec 23, 2023

I got this idea from https://www.b-list.org/weblog/2023/dec/04/python-http-status-codes/ . I always liked DRF's status and I think it makes the code easier to read. Python's http version of the same thing is not looking nice as DRF's in my opinion (.HTTP_200_OK vs .OK), but still an improvement over using directly the numeric codes.

@ulgens ulgens self-assigned this Dec 23, 2023
Copy link
Collaborator

@kiendang kiendang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have DRF as test dependency so we can use their status here. I agree that DRF's statuses look nicer and more dev-friendly too since sometimes we need to reference GraphQL specs and they mostly reference the status code directly.

@kiendang
Copy link
Collaborator

And if you want to use it in the main codebase we can alias Python's http statuses?

@firaskafri firaskafri merged commit ea45de0 into main Apr 9, 2024
12 checks passed
@firaskafri firaskafri deleted the http_status branch April 9, 2024 00:43
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.

3 participants