Improved
- qol:
ctx.redirect()
now defaults to303 See Other
instead of307
. This aligns with RFC 7231 and ensures correct behavior for POST-to-GET transitions in redirect flows. - qol:
ctx.redirect()
now only prepends the host if the to value is not absolute, not root-relative (/
), and not protocol-relative (//
). This avoids accidental double-prefixing and supports relative path routing more intuitively. - qol: Query strings are now appended safely when
keep_query
is enabled inctx.redirect()
, if the destination already contains a query (?
), parameters are appended with&
, otherwise?
is used. This ensures consistent behavior for URL merging. - qol: Calling
ctx.status()
will now explicitly clear any existing response body to prevent accidental payload leakage in status-only responses. - qol:
ctx.file()
will now always include bothfilename
andfilename*
in Content-Disposition for maximum client compatibility (per RFC 6266). In case ASCII-safe name is empty we fallback todownload
. See below (extreme) Example:
await ctx.file('/utf', {download: '📄'});
/* Expected Content-Disposition header */
'Content-Disposition': 'attachment; filename="download"; filename*=UTF-8\'\'%EF%BF%BD%EF%BF%BD'
- qol: Improved encodeFileName behavior (used in
ctx.file()
when working with download option) preventing URIError from malformedencodeURIComponent()
usage on high Unicode input by using safe byte-level encoding viaTextEncoder
.