MCPcopy
hub / github.com/promptfoo/promptfoo / startServer

Function startServer

test/fetch.compression.test.ts:31–41  ·  view source on GitHub ↗
(
  handler: (req: IncomingMessage, res: ServerResponse) => void,
)

Source from the content-addressed store, hash-verified

29let server: Server | undefined;
30
31async function startServer(
32 handler: (req: IncomingMessage, res: ServerResponse) => void,
33): Promise<string> {
34 server = createServer(handler);
35 await new Promise<void>((resolve) => server?.listen(0, '127.0.0.1', resolve));
36 const address = server.address();
37 if (!address || typeof address === 'string') {
38 throw new Error('Failed to bind test server');
39 }
40 return `http://127.0.0.1:${address.port}/compressed`;
41}
42
43async function startCompressedServer(
44 encoding: SupportedEncoding,

Callers 2

startCompressedServerFunction · 0.70

Calls 1

listenMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…