Skip to content

fix: [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client #491

Closed
@florin-nedelcu

Description

@florin-nedelcu

Hi all.
When I have the following case, routing controllers fails and try to execute both functions:

@JsonController()
export class UserController {

    @Get("/users/me")
    getMe() {
      const id = 1;
       return userRepository.findById(id);
    }

    @Get("/users/:id")
    getOne(@Param("id") id: number) {
       return userRepository.findById(id);
    }
}

As far as I read it should execute first occurency not both.
Thanks!

Metadata

Metadata

Assignees

Labels

status: done/releasedIssue has been completed, no further action is needed.type: fixIssues describing a broken feature.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions