-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe it
Currently, the @Headers() decorator does not support passing Pipes, unlike other route parameter decorators such as @Query(), @Param(), and @Body().
Reference:
https://github.com/nestjs/nest/blob/master/packages/common/decorators/http/route-params.decorator.ts#L325
For comparison, here's an overload of @query() that does support Pipes:
https://github.com/nestjs/nest/blob/master/packages/common/decorators/http/route-params.decorator.ts#L386-L389
Describe the solution you'd like
Add @Headers() decorator overload(s) that support Pipes. To fully support this enhancement, Paramtype would also need to be extended to include 'headers':
https://github.com/nestjs/nest/blob/master/packages/common/interfaces/features/paramtype.interface.ts#L4
This is important because the Paramtype value is passed via the ArgumentMetadata parameter to any PipeTransform:
https://github.com/nestjs/nest/blob/master/packages/common/interfaces/features/pipe-transform.interface.ts#L44
Teachability, documentation, adoption, migration strategy
.
What is the motivation / use case for changing the behavior?
Adding Pipe support to @Headers() would bring it to feature parity with the other route parameter decorators.