MCPcopy Create free account
hub / github.com/chimurai/http-proxy-middleware / createMockRequest

Function createMockRequest

test/test-utils.ts:6–11  ·  view source on GitHub ↗
(options: Partial<IncomingMessage> = {})

Source from the content-addressed store, hash-verified

4import { vi } from 'vitest';
5
6export function createMockRequest(options: Partial<IncomingMessage> = {}): IncomingMessage {
7 const req = new IncomingMessage(new Socket());
8 Object.assign(req, options);
9
10 return req;
11}
12
13export function createMockResponse(request = createMockRequest()): ServerResponse {
14 const response = new ServerResponse(request);

Callers 8

createMockResponseFunction · 0.85
router.spec.tsFile · 0.85
createRequestWithBodyFunction · 0.85
websocket.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by 1

createRequestWithBodyFunction · 0.68