Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/nestjs/nest
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Dec 3, 2024
2 parents 3f127e6 + 265f6d0 commit c5bbd1e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/common/decorators/http/route-params.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,32 @@ export function Body(
*/
export function RawBody(): ParameterDecorator;

/**
* Route handler parameter decorator. Extracts the `rawBody` Buffer
* property from the `req` object and populates the decorated parameter with that value.
* Also applies pipes to the bound rawBody parameter.
*
* For example:
* ```typescript
* async create(@RawBody(new ValidationPipe()) rawBody: Buffer)
* ```
*
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound body parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Raw body](https://docs.nestjs.com/faq/raw-body)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export function RawBody(
...pipes: (
| Type<PipeTransform<Buffer | undefined>>
| PipeTransform<Buffer | undefined>
)[]
): ParameterDecorator;

/**
* Route handler parameter decorator. Extracts the `rawBody` Buffer
* property from the `req` object and populates the decorated parameter with that value.
Expand Down

0 comments on commit c5bbd1e

Please sign in to comment.