• Version 4.3.12
  • Published
  • 7.41 kB
  • 1 dependency
  • MIT license


npm i @types/koa-bodyparser
yarn add @types/koa-bodyparser
pnpm add @types/koa-bodyparser


TypeScript definitions for koa-bodyparser



function bodyParser

bodyParser: (opts?: bodyParser.Options) => Koa.Middleware;


    interface Options

    interface Options {}

      property detectJSON

      detectJSON?: ((ctx: Koa.Context) => boolean) | undefined;
      • custom json request detect function. Default is null

      property enableTypes

      enableTypes?: string[] | undefined;
      • parser will only parse when request type hits enableTypes, default is ['json', 'form'].

      property encoding

      encoding?: string | undefined;
      • requested encoding. Default is utf-8 by co-body

      property extendTypes

      | {
      json?: string[] | string | undefined;
      form?: string[] | string | undefined;
      text?: string[] | string | undefined;
      | undefined;
      • support extend types

      property formLimit

      formLimit?: string | undefined;
      • limit of the urlencoded body. If the body ends up being larger than this limit a 413 error code is returned. Default is 56kb

      property jsonLimit

      jsonLimit?: string | undefined;
      • limit of the json body. Default is 1mb

      property onerror

      onerror?: ((err: Error, ctx: Koa.Context) => void) | undefined;
      • support custom error handle

      property strict

      strict?: boolean | undefined;
      • when set to true, JSON parser will only accept arrays and objects. Default is true

      property textLimit

      textLimit?: string | undefined;
      • limit of the text body. Default is 1mb.

      property xmlLimit

      xmlLimit?: string | undefined;
      • limit of the xml body. Default is 1mb.

      Package Files (1)

      Dependencies (1)

      Dev Dependencies (0)

      No dev dependencies.

      Peer Dependencies (0)

      No peer dependencies.


      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/koa-bodyparser.

      • Markdown
      • HTML
        <a href="https://www.jsdocs.io/package/@types/koa-bodyparser"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>