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

Send 400 bad request error for no user-id header in api request #1988

Merged
merged 3 commits into from
Sep 26, 2024

Conversation

ppratikcr7
Copy link
Collaborator

This resolves #1987

req.logger.debug({ message: 'User Id is:', user_id });
if (!user_id) {
const error = new Error(`User-Id header not found.`);
(error as any).type = SERVER_ERROR.USER_NOT_FOUND;
Copy link
Collaborator

Choose a reason for hiding this comment

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

well it's a bad request type, not really a user not found, the server has incomplete info to even try to find a user

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@danoswaltCL Yeah, I was also thinking to add a new ERROR type: MISSING_HEADER_USER_ID. But, got an input from our playpower team to reuse existing one's. I know this is for logged in user data not found from DB. I will update this if the above type looks good to you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Screenshot 2024-09-26 at 2 04 58 PM

@danoswaltCL danoswaltCL merged commit 29ca3bb into dev Sep 26, 2024
14 checks passed
@danoswaltCL danoswaltCL deleted the bugfix/v6-no-user-id-header-issue-1987 branch September 26, 2024 15:31
@ppratikcr7 ppratikcr7 restored the bugfix/v6-no-user-id-header-issue-1987 branch September 26, 2024 17:06
@ppratikcr7
Copy link
Collaborator Author

@danoswaltCL I was yet to push the commit with your requested change, just showed you that does this looks good. Will create another small PR for the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants