Highlights
This beta adds a cookie jar for clients outside the browser, HEAD support for GET procedures, a streaming option for batch responses, and a new OpenAPI router. One breaking change affects custom OpenAPI error responses.
import { BatchLinkPlugin, CookieJarLinkPlugin } from '@orpc/client/plugins'
import { HeadMethodHandlerPlugin } from '@orpc/server/plugins'
// Server: answer HEAD with the matching GET procedure's status and headers
const handler = new OpenAPIHandler(router, {
plugins: [new HeadMethodHandlerPlugin()],
})
// Client: keep cookies in SSR, scripts, and tests, and stream batch responses
const link = new RPCLink({
origin,
url: '/rpc',
plugins: [
new CookieJarLinkPlugin({ origin }),
new BatchLinkPlugin({
mode: 'streaming', // default: 'buffered'
groups: [{ condition: () => true, context: {} }],
}),
],
})- Cookie Jar:
CookieJarLinkPluginstores cookies servers set and sends them back, like a browser. Docs - HEAD method:
HeadMethodHandlerPluginanswersHEADwith the matchingGETprocedure, without the body. Docs - Batch response modes:
buffered(default) keeps headers and cookies;streamingsends each response as soon as it is ready. Docs - OpenAPI router: routing now uses
@openapi-spec/router, which matches OpenAPI path templates directly. Only edge cases change: overlapping routes rank literal > param > catch-all per segment, empty segments are kept, and the first duplicate route wins. Docs - Breaking: returning
nullorundefinedfromerrorResponseBodyEncoder,errorResponseBodyDecoder, orerrorResponseBodySchemano longer falls back to the default. Callerror.toJSON(),defaultError(), ordefaultSchema()instead. Handler · Link
🚨 Breaking Changes
🚀 Features
- client: Add CookieJarLinkPlugin - by @dinwwwh in #2366 (6567c)
- openapi: Upgrade openapi-spec to 0.6.0 and replace rou3 with its router - by @dinwwwh in #2370 (8e13d)
- rpc: Bring back batch response mode, buffered by default - by @dinwwwh in #2369 (c7ae6)
- server: Add HeadMethodHandlerPlugin - by @dinwwwh in #2353 (82a71)
🐞 Bug Fixes
- Upgrade standard-server to 0.14.0 - by @dinwwwh and Claude in #2371 (62711)
- openapi: Keep additionalProperties on bodies split from path params - by @dinwwwh in #2364 (b3a73)
- rpc: Skip unknown meta types when deserializing - by @dinwwwh in #2357 (344b3)