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

Replace Hardcoded HTTP Status values with http.HTTPStatus #319

Open
maxachis opened this issue Jun 3, 2024 · 0 comments
Open

Replace Hardcoded HTTP Status values with http.HTTPStatus #319

maxachis opened this issue Jun 3, 2024 · 0 comments
Assignees
Labels
in_dev This is merged into the dev environment and waiting to be merged into main refactor Improve the code without changing the underlying logic

Comments

@maxachis
Copy link
Contributor

maxachis commented Jun 3, 2024

Currently, all parts of the backend code which return responses provide the HTTP status code as an integer. For example, in Login.py:

return {"message": "Invalid email or password"}, 401

When designing responses or interpreting existing responses, this means I have to have a tab open to interpret different HTTP Status Codes.

A more readable option would be to replace the HTTP Status codes with enums, conveniently provided by native python library http as HTTPStatus. To give an example for the above code:

return {"message": "Invalid email or password"}, HTTPStatus.UNAUTHORIZED
@maxachis maxachis added the refactor Improve the code without changing the underlying logic label Jun 3, 2024
@EvilDrPurple EvilDrPurple self-assigned this Jun 16, 2024
@EvilDrPurple EvilDrPurple linked a pull request Jun 16, 2024 that will close this issue
@maxachis maxachis added the in_dev This is merged into the dev environment and waiting to be merged into main label Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in_dev This is merged into the dev environment and waiting to be merged into main refactor Improve the code without changing the underlying logic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants