Skip to content

Commit c5bbd1e

Browse files
Merge branch 'master' of https://github.com/nestjs/nest
2 parents 3f127e6 + 265f6d0 commit c5bbd1e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

packages/common/decorators/http/route-params.decorator.ts

+26
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,32 @@ export function Body(
524524
*/
525525
export function RawBody(): ParameterDecorator;
526526

527+
/**
528+
* Route handler parameter decorator. Extracts the `rawBody` Buffer
529+
* property from the `req` object and populates the decorated parameter with that value.
530+
* Also applies pipes to the bound rawBody parameter.
531+
*
532+
* For example:
533+
* ```typescript
534+
* async create(@RawBody(new ValidationPipe()) rawBody: Buffer)
535+
* ```
536+
*
537+
* @param pipes one or more pipes - either instances or classes - to apply to
538+
* the bound body parameter.
539+
*
540+
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
541+
* @see [Raw body](https://docs.nestjs.com/faq/raw-body)
542+
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
543+
*
544+
* @publicApi
545+
*/
546+
export function RawBody(
547+
...pipes: (
548+
| Type<PipeTransform<Buffer | undefined>>
549+
| PipeTransform<Buffer | undefined>
550+
)[]
551+
): ParameterDecorator;
552+
527553
/**
528554
* Route handler parameter decorator. Extracts the `rawBody` Buffer
529555
* property from the `req` object and populates the decorated parameter with that value.

0 commit comments

Comments
 (0)