Skip to content

Use custom fetch(er) for the web client #315

Closed
@arfath-linklet

Description

@arfath-linklet

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions