fix : return 404 instead of 403 when deleting a non-existent repository#2478
fix : return 404 instead of 403 when deleting a non-existent repository#2478tmdeveloper007 wants to merge 1 commit into
Conversation
The DELETE handler was returning HTTP 403 when deleteRepository() throws 'Repository not found'. This is semantically incorrect — a 403 indicates forbidden access to an existing resource, whereas the resource does not exist, so HTTP 404 is the correct status. Closes nisshchayarathi#2470
|
@tmdeveloper007 is attempting to deploy a commit to the Nisshchaya's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn the ChangesDELETE Handler Status Code Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The DELETE handler returned HTTP 403 when
deleteRepository()throwsRepository not found. This is semantically incorrect — a 403 indicates forbidden access to an existing resource, whereas the resource does not exist, so HTTP 404 is correct.Changes
app/api/repositories/[id]/route.ts: Changed status code from 403 to 404 in the DELETE handler when the repository is not found.Impact
Clients can now correctly distinguish between "access denied" and "resource does not exist" responses.
Closes #2470
Summary by CodeRabbit