Skip to content

Inconsistent behavior for the @Get(""), @Post("") ... methods #48

@DevItaliya22

Description

@DevItaliya22

Describe the bug
When the route is defined as @Post("/"), making a POST request to http://localhost:3000/post does not work (throws a 404 error). Only http://localhost:3000/post/ works.

To Reproduce
Steps to reproduce the behavior:

  1. Define a POST route with @Post("/") in the PostController.
  2. Start the server.
  3. Make a POST request to http://localhost:3000/post (throws a 404 error).
  4. Make a POST request to http://localhost:3000/post/ (works).

Expected behavior
The route should work for both http://localhost:3000/post and http://localhost:3000/post/ seamlessly.

Screenshots
image

Desktop (please complete the following information):

  • OS: [e.g., Windows 11]
  • Browser: [e.g., Postman]
  • Version: [e.g., v10.14]

Additional context
This issue is caused by the route handling logic not normalizing paths without trailing slashes. A fix could involve ensuring that both cases are treated equivalently.

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