MCPcopy
hub / github.com/axios/axios / startEcho

Function startEcho

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

Source from the content-addressed store, hash-verified

791 // is neutralized end-to-end by the null-prototype config.
792 describe('Full gadget coverage via null-prototype config', () => {
793 function startEcho(handler) {
794 return new Promise((resolve) => {
795 const server = http.createServer(
796 handler ||
797 ((req, res) => {
798 let body = '';
799 req.on('data', (c) => (body += c));
800 req.on('end', () => {
801 res.writeHead(200, { 'Content-Type': 'application/json' });
802 res.end(
803 JSON.stringify({
804 url: req.url,
805 method: req.method,
806 headers: req.headers,
807 body,
808 })
809 );
810 });
811 })
812 );
813 server.listen(0, '127.0.0.1', () => resolve(server));
814 });
815 }
816 const stop = (s) => new Promise((r) => s.close(r));
817
818 it('should ignore polluted transformRequest', async () => {

Callers 1

Calls 1

endMethod · 0.80

Tested by

no test coverage detected