---
changelog:
  category: Release
  version: 0.3.0
date: '2026-11-15T13:10:23Z'
seo:
  description: >-
    core: The client passes response bodies to codecs directly. A response body
    that fails while it is read now rejects like a body that cannot be decoded,
    with…
title: v0.3.0
type: changelog
---
core:
- The client passes response bodies to codecs directly. A response body that fails while it is read now rejects like a body that cannot be decoded, with the read error as `cause`. ([da819aa](https://github.com/simoalanne/rest-rpc/commit/da819aa))

core:
- The client skips event stream frames without data, such as keepalive comments, and drops an incomplete last frame, instead of ending the stream with an error. ([da819aa](https://github.com/simoalanne/rest-rpc/commit/da819aa))

core, server:
- `serializedBody()` takes its `headers` as a plain object of header names and values instead of any Fetch `HeadersInit`, and `SerializedBody.headers` is that object with lowercase names instead of a Fetch `Headers`. Replace `new Headers(...)` or header tuples passed to it with an object, and read the headers of a serialized body as `serialized.headers["content-type"]` instead of with `get()`. ([64804e5](https://github.com/simoalanne/rest-rpc/commit/64804e5))

core, server:
- A `mountPath` that ends with a slash, such as `/api/`, now serves the routes like `/api`, instead of responding to every request with an `INTERNAL_SERVER_ERROR`. A `.prefix()` that ends with a slash is now a type error instead of a runtime error. ([da819aa](https://github.com/simoalanne/rest-rpc/commit/da819aa))

core, server:
- A body's content type now always replaces a `content-type` passed in headers. Before, a passed header could override it, including the content type and multipart boundary the runtime sets for `FormData`. Routes with inferred responses now type `contentType` in client results as the received lowercase base media type, such as `text/csv` for `text/csv; charset=utf-8`. On routes with defined responses, `respond()` uses `contentType` as given, so a value that is not one of the defined media types throws. ([da819aa](https://github.com/simoalanne/rest-rpc/commit/da819aa))

core, server:
- Body deserializers receive an `IncomingBody` and the complete content type, as `deserialize(body, contentType)`, like serializers receive the content type. `IncomingBody` has `text()`, `json()`, `arrayBuffer()`, `blob()` and `body`, which Fetch requests and responses already have, so codecs that only use these work unchanged. Codecs that call other `Request` or `Response` members, such as `formData()`, must read the body with these instead, such as `new Response(await body.arrayBuffer(), { headers: { "content-type": contentType } }).formData()`. A codec used only on one side can no longer treat its source as a `Request` or `Response`. ([64804e5](https://github.com/simoalanne/rest-rpc/commit/64804e5))

server:
- `compileRoutes` is renamed `createRouteHandlers`, and its options type `CompileRoutesOptions` is renamed `CreateRouteHandlersOptions`. `createCatchAllHandler` now takes the route tree and the same options instead of compiled routes, in both `@rest-rpc/server` and `@rest-rpc/server/node`: replace `createCatchAllHandler(compileRoutes(routes, options))` with `createCatchAllHandler(routes, options)`. ([64804e5](https://github.com/simoalanne/rest-rpc/commit/64804e5))

server:
- `onError` receives a thrown defined error as it was thrown, instead of a copy with the defined status, validated `data` and headers, and the thrown error as `cause`. Its `cause` is now the one passed when throwing, so `errors.CODE({ cause })` reaches `onError` as `error.cause`. The response still uses the definition. A `new RouteError(code)` for a code the route defines keeps its own status in `onError`, which defaults to 400, while the defined status is sent. Defined errors with synchronous schemas are now resolved without a promise, and errors received from `call()` and the local client have no `cause`, like errors received over HTTP. ([64804e5](https://github.com/simoalanne/rest-rpc/commit/64804e5))

server:
- `serve` and `ServeOptions` are removed from `@rest-rpc/server/node`. It now exports `createApp`, which takes the route tree and returns a request listener for `http.createServer()`, so the server is started and configured with Node's own API: replace `serve(createApp(routes, options), { port })` with `createServer(createApp(routes, options)).listen(port)`, importing `createApp` from `@rest-rpc/server/node`. Its `context` function receives the `IncomingMessage`, and `notFound` writes to the `ServerResponse` and keeps the default response when it writes nothing. ([64804e5](https://github.com/simoalanne/rest-rpc/commit/64804e5))

server:
- Reject functions passed to `.static()` in types, which accepted them on routes without defined responses although static values are not called. Type errors now say why a promise, function or stream is not a valid static value instead of reporting a bare `never`. Static routes no longer check at runtime for values that bypass the types. ([05ab0d0](https://github.com/simoalanne/rest-rpc/commit/05ab0d0))

server:
- Serve `createApp` routes registered with Bun's native router through one promise per request instead of nested async wrappers, which lowers per-request overhead. ([359e26f](https://github.com/simoalanne/rest-rpc/commit/359e26f))

server:
- The Node handlers from `@rest-rpc/server/node` read the Node request and write the Node response directly, instead of converting them to a Fetch `Request` and `Response`, which lowers per-request overhead. `onError` passed to them now receives the `IncomingMessage` instead of a Fetch `Request`. Stream responses send their headers before the first item on Node. ([64804e5](https://github.com/simoalanne/rest-rpc/commit/64804e5))
