Skip to content

why will method be executed when the previous method return a result? #20

@lp6moon

Description

@lp6moon

when I visit: http://localhost:3000/api/user/all?id=123
the result is '{"id":"all","flag":"getOne"}',but there is a Error: Can't set headers after they are sent.
why will Method:getAll be executed when Method:getOne return a result?

import {Controller, JsonResponse, Param, Get, QueryParam} from "routing-controllers";

@Controller('/user')
export class UserController {

    @Get("/:id")
    @JsonResponse()
    getOne(@Param("id") id:string) {
        console.log('getOne');
        return {id:id,flag:'getOne'};
    }

    @Get("/all")
    getAll(@QueryParam("id") id:number) {
        console.log('getAll');
        return {id:id,flag:'getAll'};
    }
}

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