Skip to content

Commit

Permalink
fix: Changed status code to 409 for sending Conflict response (#2339)
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajjs authored Jan 9, 2025
1 parent 07b8720 commit 5c80de0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controllers/onboardingExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const createOnboardingExtensionRequestController = async (req: Onboarding
});

if(latestExtensionRequest && latestExtensionRequest.state === REQUEST_STATE.PENDING){
return res.boom.badRequest(REQUEST_ALREADY_PENDING);
return res.boom.conflict(REQUEST_ALREADY_PENDING);
}

const millisecondsInThirtyOneDays = convertDaysToMilliseconds(31);
Expand Down
6 changes: 3 additions & 3 deletions test/integration/onboardingExtension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe("/requests Onboarding Extension", () => {
})
})

it("should return 400 response when a user already has a pending request", (done)=> {
it("should return 409 response when a user already has a pending request", (done)=> {
createUserStatusWithState(testUserId, userStatusModel, userState.ONBOARDING);
requestsQuery.createRequest({...extensionRequest, state: REQUEST_STATE.PENDING, userId: testUserId});

Expand All @@ -225,8 +225,8 @@ describe("/requests Onboarding Extension", () => {
.send(body)
.end((err, res) => {
if (err) return done(err);
expect(res.statusCode).to.equal(400);
expect(res.body.error).to.equal("Bad Request");
expect(res.statusCode).to.equal(409);
expect(res.body.error).to.equal("Conflict");
expect(res.body.message).to.equal(REQUEST_ALREADY_PENDING);
done();
})
Expand Down

0 comments on commit 5c80de0

Please sign in to comment.