Return 200 with empty array for /my/projects when user has no projects#428
Merged
thehabes merged 4 commits intodevelopmentfrom Dec 10, 2025
Merged
Return 200 with empty array for /my/projects when user has no projects#428thehabes merged 4 commits intodevelopmentfrom
thehabes merged 4 commits intodevelopmentfrom
Conversation
…h no projects Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix 404 error for my/projects route
Return 200 with empty array for /my/projects when user has no projects
Dec 9, 2025
Member
|
@copilot there should be no changes to the package-lock.json file |
Co-authored-by: thehabes <3287006+thehabes@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix my/projects endpoint to return proper empty response
For new users with no projects, the
/my/projectsendpoint currently returns a 404 error. This is misleading as it suggests the user or path is missing. Instead, it should return a 200 status with an appropriate empty response body.Plan:
/my/projectsendpoint to return 200 with empty projects array when user has no projectsChanges Made:
Modified
/my/projectsendpoint inuserProfile/privateProfile.js:{ metrics: null, projects: [] }for empty project listsAdded test case in
classes/User/__tests__/unit.test.js:Updated API documentation in
API.md:Validation:
Security Summary:
CodeQL identified a pre-existing CSRF protection issue in
app.jsrelated to cookie middleware. This issue exists in the codebase before my changes and is not introduced by this fix. My changes do not introduce any new security vulnerabilities. The CSRF issue should be addressed separately as it affects the entire application, not just the/my/projectsendpoint.Breaking Changes:
This is technically a breaking change for any API consumers expecting HTTP 404 for users with no projects. However:
No issues need to be created in TPEN-Interfaces as the existing implementation handles this change correctly.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.