clickhouse-js icon indicating copy to clipboard operation
clickhouse-js copied to clipboard

Use custom fetch(er) for the web client

Open arfath-linklet opened this issue 5 months ago • 0 comments

Use case

By default the web client uses the global fetch. The idea is to configure the client with a custom fetch(er) that may decorate the fetch function with additional functionality. A use case for this could be -

Using mTLS: Cloudflare Workers can use mTLS with added bindings, the binding exposes a fetch(er) with mTLS pre-configured

Describe the solution you'd like

  const client = createClient({
    // A custom fetcher with decorated functionality, in this case a Cloudflare Worker binding with a fetcher preconfigured with mTLS
    fetcher: cloudflareEnv.MY_CERT.fetch
  })

Additional context

https://developers.cloudflare.com/workers/runtime-apis/bindings/mtls

arfath-linklet avatar Sep 13 '24 14:09 arfath-linklet