import '../assert_dev_env.js';
/**
 * Cookie-threading HTTP transport for cross-process tests.
 *
 * Wraps the global `fetch` against a base URL, carries cookies across
 * requests in a `Map`-backed jar so the session cookie set on bootstrap
 * is re-sent on every subsequent call. Satisfies the `RpcTestTransport`
 * shape `Hono.request` already does — so every suite body that takes
 * `transport: RpcTestTransport` works against a cross-process binary
 * unchanged.
 *
 * The `Origin` header is threaded onto every request because the
 * backend's allowlist (`{ZZZ,ZAP,FUZ}_ALLOWED_ORIGINS`) rejects mutations
 * without an `Origin`. Cross-process tests run with
 * `ALLOWED_ORIGINS=http://localhost:*`, so defaulting `origin` to the
 * configured `base_url` is safe.
 *
 * The cookie jar is intentionally simple — it does not honour `Domain`,
 * `Path`, `Expires`, or `SameSite` attributes. Cross-process tests
 * always hit a single host:port, so name-keyed last-write-wins matches
 * the behaviour real browsers exhibit against the same surface.
 *
 * @module
 */
import type { RpcTestTransport } from '../rpc_helpers.js';
/** Construction options for `create_fetch_transport`. */
export interface FetchTransportOptions {
    /** Base URL the binary is reachable at — e.g. `http://localhost:8788`. */
    readonly base_url: string;
    /**
     * Initial cookie values to seed the jar. Pass the `Set-Cookie` values
     * captured from a prior `bootstrap()` call to keep the keeper session
     * across a transport-recreation boundary. Each entry is a full
     * `Set-Cookie` value (the same string `Headers.getSetCookie()` returns).
     */
    readonly initial_cookies?: ReadonlyArray<string>;
    /**
     * Origin header threaded onto every request when the caller hasn't set
     * one. Defaults to `base_url`; backends running with
     * `ALLOWED_ORIGINS=http://localhost:*` accept `http://localhost:<port>`
     * matching the spawned binary.
     *
     * Pass `null` to disable the default — useful for bearer-only probes
     * that must not look like browser-context requests (the auth middleware
     * silently discards bearer credentials when `Origin`/`Referer` is
     * present). Callers can still set `Origin` per-call via `init.headers`.
     */
    readonly origin?: string | null;
}
/**
 * The transport shape: callable as `RpcTestTransport` plus a `cookies()`
 * accessor that returns the current jar state. The accessor exists so
 * `ws_transport` can thread the session cookie onto the WS upgrade
 * without an HTTP round trip.
 */
export interface FetchTransport extends RpcTestTransport {
    /**
     * Snapshot of every cookie currently in the jar, formatted as full
     * `Set-Cookie` values (`name=value`). Used by `ws_transport` to
     * compose the `Cookie` header on the upgrade request.
     */
    readonly cookies: () => ReadonlyArray<string>;
}
/**
 * Build a cookie-threading transport pinned to `options.base_url`. The
 * returned function carries a private `Map<name, cookie-head>` jar that
 * updates on every response's `Set-Cookie` and re-sends on every
 * subsequent request.
 *
 * Request rewriting:
 *
 * - Absolute URLs (`http://other.example/...`) pass through verbatim —
 *   handy for cross-origin negative tests that target a deliberately
 *   different host.
 * - Relative URLs are resolved against `base_url`.
 * - `Origin` is set to `options.origin ?? base_url` unless the caller
 *   already provided one.
 * - `Cookie` is set from the jar unless the caller already provided one.
 */
export declare const create_fetch_transport: (options: FetchTransportOptions) => FetchTransport;
//# sourceMappingURL=fetch_transport.d.ts.map