Aller au contenu principal
Version: Next

BodyParserOptions

Index

Properties

optionaldetectJSON

detectJSON?: (ctx: IMidwayKoaContext) => boolean

optionalenable

enable?: boolean

optionalenableTypes

enableTypes?: string[]

parser will only parse when request type hits enableTypes, default is [‘json’, ‘form’].

optionalencoding

encoding?: string

requested encoding. Default is utf-8 by co-body

optionalextendTypes

extendTypes?: { form?: string | string[]; json?: string | string[]; text?: string | string[] }

support extend types

optionalformLimit

formLimit?: string

limit of the urlencoded body. If the body ends up being larger than this limit a 413 error code is returned. Default is 56kb

optionaljsonLimit

jsonLimit?: string

limit of the json body. Default is 1mb

optionalonerror

onerror?: (err: Error, ctx: IMidwayKoaContext) => void

optionalstrict

strict?: boolean

when set to true, JSON parser will only accept arrays and objects. Default is true

optionaltextLimit

textLimit?: string

limit of the text body. Default is 1mb.

optionalxmlLimit

xmlLimit?: string

limit of the xml body. Default is 1mb.