diff --git a/content/docs/basics/body_parser.md b/content/docs/basics/body_parser.md index 141a400b..6e84f75d 100644 --- a/content/docs/basics/body_parser.md +++ b/content/docs/basics/body_parser.md @@ -216,6 +216,7 @@ See also: [File uploads](./file_uploads.md) ```ts multipart: { + enabled: true, autoProcess: true, processManually: [], encoding: 'utf-8', @@ -230,6 +231,20 @@ multipart: {
+enabled + +
+ +
+ +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`. + +
+ +
+ autoProcess
diff --git a/content/docs/basics/file_uploads.md b/content/docs/basics/file_uploads.md index 8863f4b8..76dd7937 100644 --- a/content/docs/basics/file_uploads.md +++ b/content/docs/basics/file_uploads.md @@ -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.