File tree 1 file changed +26
-0
lines changed
packages/common/decorators/http
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -524,6 +524,32 @@ export function Body(
524
524
*/
525
525
export function RawBody ( ) : ParameterDecorator ;
526
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
+
527
553
/**
528
554
* Route handler parameter decorator. Extracts the `rawBody` Buffer
529
555
* 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