TriFrost always came with a body parser — it handled JSON, plain text, and buffers just fine. But real-world backends need more. Forms. File uploads. Multilingual characters. Legacy formats. Inconsistent charsets. It adds up fast.
This release brings with it an overhaul of the Falcon-era body parser and replaces it with a modern, reliable body parsing layer that just works across everything — utf-8
, utf-16
, nested forms, typed values, file uploads — no matter the runtime.
Added
- feat: Richer body parsing — Full support for
application/x-www-form-urlencoded
andmultipart/form-data
. Clean objects out of the box. File uploads return modernFile
instances. - feat: Smart decoding — UTF-8 and UTF-16 (LE/BE, with or without BOM) are parsed seamlessly, across all supported runtimes.
- feat: More JSON types — Now handles
text/json
(for those pesky legacy servers),application/ld+json
, and newline-delimitedapplication/x-ndjson
.
Improved
- qol: Body parsing is now consistent, robust, and intelligent. Forms, uploads, and edge cases just work — with proper type casting, nested keys, arrays, dates, booleans, and more (thanks to toObject())
- deps: Upgrade @cloudflare/workers-types to 4.20250515.0
Here’s what that looks like in practice:
🧾 LDJSON
In:
{"id":1,"name":"Tri"}
{"id":2,"name":"Frost"}
Out:
/* ctx.body */
{raw: [{id: 1, name: 'Tri'}, {id: 2, name: 'Frost'}]}
📮 URL-encoded form
In:
username=TriFrost&admin=true&joined=2025-01-01T00%3A00%3A00Z&tags[]=alpha&tags[]=beta
Out:
/* ctx.body */
{
username: 'TriFrost',
admin: true,
joined: new Date('2025-01-01T00:00:00Z'),
tags: ['alpha', 'beta']
}
📤 Multipart form-data
In:
Content-Disposition: form-data; name="bio"
> loves fast APIs
Content-Disposition: form-data; name="avatar"; filename="me.png"
> binary image data
Out:
/* ctx.body */
{
bio: 'loves fast APIs',
avatar: File // with name, type, size, etc.
}
Bottom line: Whether you're posting a login form, uploading a file, or streaming NDJSON from a service — TriFrost now parses it all for you. Automatically. Reliably. Cross-runtime.