---
changelog:
  category: Release
  version: 0.6.0
date: '2026-11-21T01:21:06Z'
seo:
  description: >-
    core, server: Custom codecs take precedence over the built-in ones for every
    media type they match, patterns included. A codec such as bodyCodec(/.*/,
    ...)…
title: v0.6.0
type: changelog
---
core, server:
- Custom codecs take precedence over the built-in ones for every media type they match, patterns included. A codec such as `bodyCodec(/.*/, ...)` now also handles `application/json`, `application/x-www-form-urlencoded` and `multipart/form-data`, which used to stay with the built-in codecs because they list them as strings. Within the custom codecs, a media type listed as a string is still selected before patterns. ([bddf9bc](https://github.com/simoalanne/rest-rpc/commit/bddf9bc))

core, server:
- Rename the client types to match the other `Client` types: `ApiClientFor` is now `ClientFor`, `ApiClientOptions` is now `CreateClientOptions`, and `ApiClientRouteValue` is now `ClientRouteValue`. ([f150152](https://github.com/simoalanne/rest-rpc/commit/f150152))

core, server:
- Server-Sent Events and error responses never use body codecs, on either side. The server writes event streams without passing them through the codecs, and the client reads error bodies with the built-in codecs only, so a custom codec that matches `application/json`, such as a catch-all pattern, no longer breaks defined errors. ([bddf9bc](https://github.com/simoalanne/rest-rpc/commit/bddf9bc))

core, server:
- Throw `BodySerializationError` from the built-in codecs' `serialize` for a value they don't encode. It extends `TypeError` and carries the `mediaType` the value was serialized for, the value kinds the codec `expected`, and the kind of value it `received`. The JSON codec still throws the errors of `JSON.stringify`. ([bddf9bc](https://github.com/simoalanne/rest-rpc/commit/bddf9bc))

server:
- Accept `FormData` request bodies without a declared content type. A route whose headers schema declares no `content-type` now decodes `multipart/form-data` as well as JSON, so `route.body(type<FormData>())` works with a client that sends `FormData` and no `content-type` header, which Fetch sets with the generated boundary. Such routes no longer answer multipart requests with `415`, so a route that shouldn't take `FormData` rejects it with its body schema. ([0e5ba74](https://github.com/simoalanne/rest-rpc/commit/0e5ba74))

tanstack-query:
- Add a `fetch` function to each route's TanStack Query utils that calls the underlying client route directly ([aae3fd4](https://github.com/simoalanne/rest-rpc/commit/aae3fd4))
