-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Better HTTP error codes #250
base: master
Are you sure you want to change the base?
Conversation
It's better to use 401 for lack of permission and 409 if the user already exists https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409
@@ -127,7 +127,7 @@ def read_user_by_id( | |||
return user | |||
if not crud.user.is_superuser(current_user): | |||
raise HTTPException( | |||
status_code=400, detail="The user doesn't have enough privileges" | |||
status_code=401, detail="The user doesn't have enough privileges" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a 403
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@machadoug Can you change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, it should be a 403
Seems like a stale PR. Could that be closed now? |
This branch is way behind Should be
|
It's better to use 401 for lack of permission and 409 if the user already exists
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409