in-process-request
Version:
A node.js library that executes a http handler function in the current process without having to start a local http server.
21 lines (20 loc) • 671 B
TypeScript
/// <reference types="node" />
import { IncomingHttpHeaders, OutgoingHttpHeaders, ServerResponse, IncomingMessage } from 'http';
export interface MockRequestOptions {
method?: string;
path: string;
body?: string | Buffer;
headers?: IncomingHttpHeaders;
remoteAddress?: string;
remotePort?: number;
ssl?: boolean;
}
export interface MockResponse {
body: Buffer;
isUTF8: boolean;
statusCode: number;
statusMessage: string;
headers: OutgoingHttpHeaders;
}
export declare const createMockResponse: (req: IncomingMessage) => ServerResponse;
export declare const createMockRequest: (opts: MockRequestOptions) => IncomingMessage;