MCPcopy Index your code
hub / github.com/nodejs/node / testRequest

Function testRequest

test/es-module/test-wasm-web-api.js:18–23  ·  view source on GitHub ↗
(handler)

Source from the content-addressed store, hash-verified

16// Sets up an HTTP server with the given response handler and calls fetch() to
17// obtain a Response from the newly created server.
18async function testRequest(handler) {
19 const server = createServer((_, res) => handler(res)).unref().listen(0);
20 await events.once(server, 'listening');
21 const { port } = server.address();
22 return fetch(`http://127.0.0.1:${port}/foo.wasm`);
23}
24
25// Runs the given function both with the promise itself and as a continuation
26// of the promise. We use this to test that the API accepts not just a Response

Calls 7

fetchFunction · 0.85
listenMethod · 0.80
addressMethod · 0.65
createServerFunction · 0.50
handlerFunction · 0.50
unrefMethod · 0.45
onceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…