Skip to content

v0.151.0

Choose a tag to compare

@nstfkc nstfkc released this 19 Oct 03:09
· 197 commits to main since this release

Features

  • HttpResponse.redirect(url, { status = 303, headers }): a real redirect (301/302/303/307/308) with Location, for native form posts (#990, #992).
  • HttpResponse.noContent({ headers }): a 204 with no body.
  • HttpResponse.text(body, { status, headers }): text/plain; charset=utf-8 (overridable); statuses ≥ 400 get no-store like .json().
  • Stream routes accept an HttpResponse (#714): a this.stream() handler can return e.g. HttpResponse.error(502, …).

Upgrade notes

  • useQuery/useMutation now read a 204/205 response as null data (before: onError with a SyntaxError), and a text/plain body as a string; a text/plain error becomes a refusal whose message is the text.
  • HttpResponse.json(x, { status: 204 }) now throws; use HttpResponse.noContent().
  • Redirect.to/Redirect.external on API routes still answer 200 {} (documented); use HttpResponse.redirect for a real redirect.