nock/nock#1076

node v16.18.0
version: 1.0.0
endpointsharetweet
Test case for https://github.com/node-nock/nock/issues/1076
const http = require('http'); const nock = require('nock'); nock('http://localhost:4002') .get('/real') .delayConnection(1000) .reply(200, {}); const httpOptions = { agent: new http.Agent({ timeout: 10, keepAlive: true, keepAliveMsecs: 5000 }) }; const httpRes = ''; http.request('http://localhost:4002/real', httpOptions, function(res) { res.on('timeout', function () { console.log('res timeout'); }); res.on('data', function (data) { httpRes += data; }); res.on('end', function () { console.log('response received'); }); }); req.end();
Loading…

no comments

    sign in to comment