Replies: 1 comment
-
It’s probably because in express.js, .send() method consider the given number as a status code and not as a content response. returning directly a number isn’t correct because a payload is always a text or a json. Try: @Get("/count")
@Returns(200, String)
async getCount(@QueryParams("id") id: string) {
return String(5);
} or wrap the payload: import {object, number} from "@tsed/schema"
@Get("/count")
@Returns(200).Schema(object({count: number()}))
async getCount(@QueryParams("id") id: string) {
return { count: 5}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey folks,
The above code will produce an error like this:
The syntax seems correct to me, let me know if this is a bug.
Beta Was this translation helpful? Give feedback.
All reactions