Skip to content

Fix status codes in UpdateProfile, CreateObligation, and DeleteObligation#209

Open
aaryan359 wants to merge 1 commit intofossology:mainfrom
aaryan359:fix/update-profile-response-status-code
Open

Fix status codes in UpdateProfile, CreateObligation, and DeleteObligation#209
aaryan359 wants to merge 1 commit intofossology:mainfrom
aaryan359:fix/update-profile-response-status-code

Conversation

@aaryan359
Copy link
Copy Markdown
Contributor

@aaryan359 aaryan359 commented Mar 10, 2026

Changes

  • Fix UpdateProfile response body returning Status: 201 (http.StatusCreated) while the HTTP response was correctly 200 OK — body now consistently uses http.StatusOK
  • Fix CreateObligation response body returning Status: 200 (http.StatusOK) while the HTTP response was correctly 201 Created — body now consistently uses http.StatusCreated
  • Fix DeleteObligation sending c.JSON(http.StatusNotFound, er) on a DB update failure — the record was already successfully fetched at that point, so the correct status is http.StatusInternalServerError

Submitter Checklist

  • Includes tests (if there is a feature changed/added)
  • Includes docs ( if changes are user facing)
  • I have tested my changes locally.

References

Location Was Now
pkg/auth/auth.go — UpdateProfile response body Status: http.StatusCreated (201) Status: http.StatusOK (200)
pkg/api/obligations.go — CreateObligation response body Status: http.StatusOK (200) Status: http.StatusCreated (201)
pkg/api/obligations.go — DeleteObligation update failure c.JSON(http.StatusNotFound, er) (404) c.JSON(http.StatusInternalServerError, er) (500)

…d DeleteObligation

Signed-off-by: aaryan359 <aaryanmeena96@gmail.com>
@aaryan359
Copy link
Copy Markdown
Contributor Author

@deo002, I found this in the codebase. Could you please take a look and let me know if this is good?

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.

1 participant