Skip to content

GET /users/:id returns incorrect response when user is not found #2

@midnightapi

Description

@midnightapi

Problem

The GET /users/:id endpoint currently sends a response even when
the requested user does not exist.

It should properly handle the "user not found" case.

Current Behavior

  • Returns an empty or incorrect response
  • Does not use proper HTTP status code

Expected Behavior

  • If user is not found, return:
    • Status code: 404
    • JSON message explaining the error
  • Ensure only one response is sent

File to Update

controllers/user.controller.js

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions