import { IncomingMessage, IncomingHttpHeaders } from 'http'; import { Http2ServerRequest } from 'http2'; import { URL } from 'url'; /** * A handier wrapper around a request * * @public */ export interface IFetchedRequest { /** The original Node.js object representing the request */ readonly original: IncomingMessage | Http2ServerRequest; /** The connections stack */ readonly connectionsStack: readonly Readonly[]; /** The last connection in connectionsStack */ readonly connection: Readonly; /** The URL */ readonly url: URL; /** The headers */ readonly headers: IncomingHttpHeaders; /** The query parameters taken from the URL, as a read-only map of strings */ readonly queryParameters: Readonly>; /** The protocol part of the URL, without the trailing `:` */ readonly protocol: string; /** The hostname part of the URL */ readonly hostname: string; /** The port part of the URL */ readonly port: string; /** The HTTP method */ readonly method: string; /** The path part of the URL */ readonly pathname: string; /** The body content */ readonly body: Buffer; } /** * A connection intercepted by kassette * * @public */ export interface Connection { /** protocol such as `http` or `https`, without the trailing `:` */ protocol: string; /** target hostname */ hostname: string; /** target port */ port: number; }