#@Headers etc. availability

3 messages · Page 1 of 1 (latest)

full bridge
#

👋 Quick question on param decorators that rely on the request context - do these only work in controllers and other things that directly use the request context? I've tried to use e.g. @Headers in my service functions but my params end up undefined.

zealous tree
#

@Headers(), @Query(), @Body(), etc. are only for the @Controller() class's method's parameters. This is because they set metadata for the index ofthe parameter that Nest will later read and know how to map the entire request object to the parameters of the method

full bridge
#

Gotcha - makes sense. Thanks!