Major Changes
-
f858724Thanks @TheDadi! - Drop support for Node.js 18 and 20, both of which are past end-of-life (Node 18 EOL April 2025, Node 20 EOL April 2026).The minimum supported version is now Node.js 22. CI is tested against Node 22 (Maintenance LTS), 24 (Active LTS), and 26 (Current).
If you are on Node 18 or 20, upgrade to Node 22+ before updating
koa-body. No source-level API changes accompany this bump — it reflects the supported runtime floor only.
Minor Changes
-
9b3b5b6Thanks @TheDadi! - Add configurable body-type matchers:jsonTypes,urlencodedTypes,textTypes, andmultipartTypes.These options let callers customize which
Content-Typevalues are parsed as which body kind, without patching the middleware internals. Each accepts an array of types passed directly to Koa'sctx.is(...), so the standard mime patterns (e.g.urlencoded,multipart,text/*,application/vnd.custom+json) all work.Defaults preserve the previous behavior:
jsonTypes:application/json,application/json-patch+json,application/vnd.api+json,application/csp-report,application/reports+jsonurlencodedTypes:urlencodedtextTypes:text/*multipartTypes:multipart
Example — parse a vendor JSON type and a custom multipart type:
app.use( koaBody({ jsonTypes: ["application/json", "application/vnd.custom+json"], multipart: true, multipartTypes: ["multipart", "application/x-custom-multipart"], }) );