Skip to content

Commit c72f348

Browse files
authored
Update controllers.md with whitelist info
Add a hint section bellow the DTO description about the whitelist option from the ValidationPipe.
1 parent 1be4249 commit c72f348

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/controllers.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ async create(createCatDto) {
407407
}
408408
```
409409

410+
> info **Hint** Our `ValidationPipe` can filter out properties that should not be received by the method handler. In this case, we can whitelist the acceptable properties, and any property not included in the whitelist is automatically stripped from the resulting object. In the `CreateCatDto` example, our whitelist is the `name, age and breed` properties. Learn more [here.](https://docs.nestjs.com/techniques/validation#stripping-properties)
411+
410412
#### Handling errors
411413

412414
There's a separate chapter about handling errors (i.e., working with exceptions) [here](/exception-filters).

0 commit comments

Comments
 (0)