Interface Fetcher

A Fetcher interface compatible with Cloudflare Workers service bindings and standard fetch API. Used for dependency injection to support both HTTP URLs and Worker bindings.

interface Fetcher {
    fetch(input: RequestInfo | URL, init?: RequestInit<CfProperties<unknown>>): Promise<Response>;
}

Methods

Methods

  • Performs an HTTP request

    Parameters

    • input: RequestInfo | URL

      The URL or RequestInfo to fetch

    • Optionalinit: RequestInit<CfProperties<unknown>>

      Optional request initialization parameters

    Returns Promise<Response>

    A Promise that resolves to the Response