Skip to content

API Returns 200 OK Status for Non-Existent Task Instead of 404 Not Found #2290

@AnujChhikara

Description

@AnujChhikara

Issue Description

The backend API https://api.realdevsquad.com/taskRequests/:id returning a 200 OK status code along with the message "Task request returned successfully" even when the requested task ID does not exist. This is misleading because it suggests the request was successful, while the task is not actually found.

Expected Behavior

  • The API should return a 404 Not Found status code.
  • The response body should provide a clear error message, such as:
{
    "error": "Task not found"
}

The message "Task request returned successfully" should only be returned when a valid task is found.

Current Behavior

  • The API returns a 200 OK status code, regardless of whether the task ID exists or not.
  • The response body always includes:
{
    "message": "Task request returned successfully"
}

Screenshots

Reproducibility

  • This issue is reproducible
  • This issue is not reproducible

Steps to Reproduce

  • Try sending a get request to this endpoint https://api.realdevsquad.com/taskRequests/:id with a task ID that does not exist
  • Observe that the response returns a 200 OK status code with the message "Task request returned successfully".

Severity/Priority

  • Critical
  • High
  • Medium
  • Low

Additional Information

Checklist

  • I have read and followed the project's code of conduct.
  • I have searched for similar issues before creating this one.
  • I have provided all the necessary information to understand and reproduce the issue.
  • I am willing to contribute to the resolution of this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions