@koa/bodyparser
Version:
Koa body parsing middleware
24 lines (21 loc) • 778 B
text/typescript
import { Options } from 'co-body';
import * as Koa from 'koa';
declare const supportedBodyTypes: readonly ["json", "form", "text", "xml"];
type BodyType = (typeof supportedBodyTypes)[number];
type BodyParserOptions = {
parsedMethods?: string[];
patchNode?: boolean;
detectJSON?: (ctx: Koa.Context) => boolean;
onError?: (error: Error, ctx: Koa.Context) => void;
enableRawChecking?: boolean;
enableTypes?: BodyType[];
extendTypes?: {
[K in BodyType]?: string[];
};
jsonStrict?: Options['strict'];
jsonLimit?: Options['limit'];
formLimit?: Options['limit'];
textLimit?: Options['limit'];
xmlLimit?: Options['limit'];
} & Pick<Options, 'encoding'>;
export { type BodyParserOptions, type BodyType, supportedBodyTypes };