TriFrost

TriFrost 0.36.5

|peterver

News

Improved

  • qol: ctx.redirect() now defaults to 303 See Other instead of 307. 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 in ctx.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 both filename and filename* in Content-Disposition for maximum client compatibility (per RFC 6266). In case ASCII-safe name is empty we fallback to download. 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 malformed encodeURIComponent() usage on high Unicode input by using safe byte-level encoding via TextEncoder.

Loved the read? Share it with others