The screenshot API for developers -
Try ScreenshotOne
Skip to content

Request Limit Plugin

Restricts the size of incoming request bodies to protect the server from oversized payloads.

Setup

Use RequestLimitHandlerPlugin to limit the size of incoming request bodies.

ts
import { RequestLimitHandlerPlugin } from '@orpc/server/plugins'

const handler = new RPCHandler(router, {
  plugins: [
    new RequestLimitHandlerPlugin({
      /**
       * The maximum allowed request body size in bytes.
       */
      maxBodySize: 1024 * 1024, // 1MB
    }),
  ],
})

INFO

The handler can be any supported oRPC handler, such as RPCHandler, OpenAPIHandler, or a custom one.

INFO

When used with Request Compression, maxBodySize applies to the decompressed payload size, not the compressed wire size.

Learn More

For implementation details, see the source code.

Released under the MIT License.