File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
packages/common/decorators/http Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -508,6 +508,48 @@ export function Body(
508508 ) ;
509509}
510510
511+ /**
512+ * Route handler parameter decorator. Extracts the `rawBody` Buffer
513+ * property from the `req` object and populates the decorated parameter with that value.
514+ *
515+ * For example:
516+ * ```typescript
517+ * async create(@RawBody() rawBody: Buffer | undefined)
518+ * ```
519+ *
520+ * @see [Request object](https://docs.nestjs.com/controllers#request-object)
521+ * @see [Raw body](https://docs.nestjs.com/faq/raw-body)
522+ *
523+ * @publicApi
524+ */
525+ export function RawBody ( ) : ParameterDecorator ;
526+
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+
511553/**
512554 * Route handler parameter decorator. Extracts the `rawBody` Buffer
513555 * property from the `req` object and populates the decorated parameter with that value.
You can’t perform that action at this time.
0 commit comments