import type { JsonInit, JsonResponse } from './client.js'; export interface Http2Response { readonly status: number; readonly headers: Headers; readonly text: string; } /** * One HTTP/2 request against a cleartext origin, and the JSON round-trip beside * it - the same pair `testClient` gives for HTTP/1.1. * * It exists because **Bun's `fetch` cannot call an h2c origin**: both * `protocol: 'http2'` and `protocol: 'h2'` reject with `HTTP2Unsupported` * against any plain-HTTP peer, whatever that peer serves. `node:http2` opens * with the connection preface instead, which is the "prior knowledge" path * `Bun.serve({ http2: true })` answers. * * A connection per call, which is what a test wants: the assertion is about the * server, and a pooled session would carry state between cases. * * ```ts * const server = await createTestServer({ modules: [AppModule], http2: true }); * const h2 = http2Client(server.url); * * expect((await h2.json('/users')).status).toBe(200); * ``` */ export declare class Http2Client { #private; /** The origin these requests go to. */ readonly url: string; constructor(url: string, timeoutMs?: number); /** Status, headers and the raw body text. */ request(path?: string, init?: JsonInit): Promise; /** Status, headers and the parsed body, for the common assertion. */ json(path?: string, init?: JsonInit): Promise>; } /** `new Http2Client(url, timeoutMs)`. */ export declare const http2Client: (url: string, timeoutMs?: number) => Http2Client;