Route params decorators bug in ES
See original GitHub issueRoute params decorators not working properly in ES
I’m trying to use @Body decorator, but I’m getting unwanted results:
@Post('/signup')
async signUp (
@Request() req,
@Response() res,
@Body('username') username,
@Body('password') password ) {
console.log(username) //[Function: next]
console.log(password) //undefined
}
Then I tried to send the @Body decorator arguments first, but when printing them I got equivalents to the Request, Response and Next in their respective order.
@Post('/signup')
async signUp (
@Body('username') username,
@Body('password') password,
@Request() req,
@Response() res
) {
console.log(username) //IncomingMessage {......... <- req equivalent
console.log(password) //ServerResponse {...... <- res equivalent
console.log(req) //[Function: next] <- next equivalent
console.log(res) //undefined
}
I think the problem is with the order or obligation of the params
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:16 (8 by maintainers)
Top Results From Across the Web
Pass Flask route parameters into a decorator - Stack Overflow
I believe you're just missing one thing, which is to actually call require_post_data to produce a decorator function in the update_contact route.
Read more >Router Guards • Angular - codecraft.tv
There is a bug in Angular version 2.1.0 where the canDeactivate function is not passed the future ActivatedRouteSnapshot or the future RouterStateSnapshot ....
Read more >Python FastAPI — How the '@app.get(“/”)' Syntax Works
Decorators That Take In Arguments. In Python FastAPI, we use this decorator to create a route to an endpoint: @app.get("/") def function():
Read more >Untangling Python Decorators | Red's Digressions
First, I defined two functions, func_a and func_b and then func_c takes them as parameters. func_c runs the functions taken as parameters and ......
Read more >View decorators - Django documentation
Decorator to require that a view only accepts the GET and HEAD methods. These methods are commonly considered “safe” because they should not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @benbayard, @cdiaz,
Unfortunately, babel doesn’t support custom parameters decorators… This is why it’s not working without TypeScript 😞
Hi @cdiaz, Now Nest is compatible with pure JavaScript + Babel now 🙂 You can find examples in the docs.