@ts-pf/client-http
v0.1.3
Published
FetchLink and Fetch interceptors
Maintainers
Readme
@ts-pf/client-http
FetchLink and Fetch Interceptors. Implements Link from @ts-pf/client. Analog of @ts-pf/message-client.
Agent skill: skills/ts-pf-client-http/. Sync with npx skills experimental_sync -y.
Fetch interceptors wrap Request / Response inside FetchLink (headers, raw HTTP). They do not see structured RPC input or mapped PFError. Retry, cache, and in-flight dedupe belong on createClient as call interceptors / CallPlugins (RetryPlugin, DedupePlugin, CachePlugin).
import { createClient, RetryPlugin } from '@ts-pf/client'
import { FetchLink } from '@ts-pf/client-http'
const client = createClient<typeof contract>(
new FetchLink({
url: '/rpc',
interceptors: [
async ({ request, next }) => {
request.headers.set('x-trace', '1')
return next(request)
},
],
}),
{ plugins: [new RetryPlugin()] },
)Do not import this package from @ts-pf/server-http (prod).
