Skip to content

Bug: POST /tasks accepts whitespace-only titles #1

Description

@ascerra

Description

The POST /tasks endpoint allows creating tasks with whitespace-only titles like " " or "\t". The validation check only rejects falsy values (empty string, null, undefined) but doesn't trim whitespace.

Steps to reproduce

curl -X POST http://localhost:3000/tasks \
  -H "Content-Type: application/json" \
  -d '{"title": "   "}'

Expected behavior

Should return 400 with an error message like "title cannot be blank".

Actual behavior

Returns 201 and creates a task with a whitespace-only title.

Additional context

The same issue likely exists for the PATCH endpoint when updating a title to whitespace.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomerspr-openAn open PR already addresses this issueready-to-code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions