Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/hono/middleware/body-limit/index.ts>bodyLimit

Fast, Lightweight, Web-standards
Very Popular
Go to Latest
variable bodyLimit
import { bodyLimit } from "https://deno.land/x/hono@v4.2.1/middleware/body-limit/index.ts";

Body Limit Middleware

Examples

Example 1

app.post(
 '/hello',
 bodyLimit({
   maxSize: 100 * 1024, // 100kb
   onError: (c) => {
     return c.text('overflow :(', 413)
   }
 }),
 (c) => {
   return c.text('pass :)')
 }
)

type

(options: BodyLimitOptions) => MiddlewareHandler