Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add documentation for bodyparse's multipart.enabled option #191

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions content/docs/basics/body_parser.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ See also: [File uploads](./file_uploads.md)

```ts
multipart: {
enabled: true,
autoProcess: true,
processManually: [],
encoding: 'utf-8',
Expand All @@ -230,6 +231,20 @@ multipart: {

<dt>

enabled

</dt>

<dd>

Setting `enabled` to `false` will result in all multipart requests being rejected with a [415 Unsupported Media Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415) error.

By default `enabled` is set to `true`.

</dd>

<dt>

autoProcess

</dt>
Expand Down
13 changes: 13 additions & 0 deletions content/docs/basics/file_uploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@ We recommend using Drive over manually uploading and serving files. Drive handle

[Learn more about Drive](../digging_deeper/drive.md)

## Advanced - Disabling file uploads
You can turn of file upload handling and processing of multipart requests entirely, in which case a request for a multipart file upload will return a [415 Unsupported Media Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415) error to the client.

Open the `config/bodyparser.ts` file and change the following to disable multipart file uploads entirely.

```ts
{
multipart: {
enabled: false
}
}
```

## Advanced - Self-processing multipart stream
You can turn off the automatic processing of multipart requests and self-process the stream for advanced use cases. Open the `config/bodyparser.ts` file and change one of the following options to disable auto-processing.

Expand Down