koa-body
Version:
A Koa body parser middleware. Supports multipart, urlencoded and JSON request bodies.
17 lines (16 loc) • 647 B
TypeScript
import type { Context } from 'koa';
import type { JsonValue } from 'type-fest';
import type { ParseWithFormidableResult } from './parse-with-formidable.js';
export type ParseWithCoBodyIncludeUnparsedResult = {
parsed: ParseWithCoBodyResult;
raw: string;
};
export type ParseWithCoBodyResult = JsonValue;
type PatchOptions = {
isMultipart: string | boolean | null;
includeUnparsed: boolean;
patchNode: boolean;
patchKoa: boolean;
};
export declare function patchNodeAndKoa(ctx: Context, body: ParseWithFormidableResult | ParseWithCoBodyResult | ParseWithCoBodyIncludeUnparsedResult, options: PatchOptions): void;
export {};