Skip to content
rest-rpc
Esc
↑↓navigate↵open⌘Jpreview
On this page

v0.5.0

core:

  • Show a client call’s resolved response, such as { status: 200; body: Post; ... }, on hover in editors instead of an internal ClientResponseEntry type. (34a29eb)

core, server:

  • Export the built-in body codecs from @rest-rpc/core and @rest-rpc/server as jsonCodec, urlEncodedCodec, formDataCodec, textCodec and binaryCodec, so a custom codec can call one for the values it doesn’t handle. Their operations are both defined and typed with what they return, such as Promise<FormData> from formDataCodec.deserialize(). (3d6507c)

server:

  • Accept handlers that only throw, such as a stub that throws a defined NOT_IMPLEMENTED error, without a return type annotation. (d3b9f08)

server:

  • Re-export the rest of @rest-rpc/core except route from @rest-rpc/server, so server code and its tests import only @rest-rpc/server: clientInterceptor(), extractContract() and the AbsolutePath, ApiClientFor, ApiClientRouteValue, BodyDeserializer, BodySerializer, BuiltInBodyCodec, ClientHeaders, ClientInterceptor, Contract, FetchLike, FetchOptions, IncomingBody, InferClientStreamData, ResponseOptions, RouteDefinition and SseResponse types. (5deb097)

server:

  • Remove createLocalClient() and the LocalClient type. To call an app in process with the same behavior as over HTTP, such as in tests, pass its fetch to createClient(routes, { fetch: app.fetch }). createClient and ApiClientOptions are now exported from @rest-rpc/server too. To call one route without HTTP, use call(). (99c0b66)

server:

  • Run interceptors for OPTIONS requests to app.routes, as app.fetch does, so an interceptor answers CORS preflights when Bun serves app.routes without app.fetch. Bun answered them with its own 404 before. A preflight no interceptor answers is sent NOT_FOUND. (b38ff78)

Last updated on

Was this page helpful?