MCPcopy
hub / github.com/axios/axios / startServer

Function startServer

tests/unit/prototypePollution.test.js:431–442  ·  view source on GitHub ↗
(handler)

Source from the content-addressed store, hash-verified

429 // beforeRedirect, insecureHTTPParser).
430 describe('http adapter gadgets', () => {
431 function startServer(handler) {
432 return new Promise((resolve) => {
433 const server = http.createServer(
434 handler ||
435 ((req, res) => {
436 res.writeHead(200, { 'Content-Type': 'application/json' });
437 res.end(JSON.stringify({ headers: req.headers, url: req.url }));
438 })
439 );
440 server.listen(0, '127.0.0.1', () => resolve(server));
441 });
442 }
443
444 function stopServer(server) {
445 return new Promise((resolve) => server.close(resolve));

Callers 1

Calls 1

endMethod · 0.80

Tested by

no test coverage detected