mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
611 B
29 lines
611 B
'use strict';
|
|
/*
|
|
* Repeated requests for a domain that fails to resolve
|
|
* should trigger the error event after each attempt.
|
|
*/
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
function httpreq(count) {
|
|
if (count > 1) return;
|
|
|
|
const req = http.request({
|
|
host: 'not-a-real-domain-name.nobody-would-register-this-as-a-tld',
|
|
port: 80,
|
|
path: '/',
|
|
method: 'GET'
|
|
}, common.mustNotCall());
|
|
|
|
req.on('error', common.mustCall((e) => {
|
|
assert.strictEqual(e.code, 'ENOTFOUND');
|
|
httpreq(count + 1);
|
|
}));
|
|
|
|
req.end();
|
|
}
|
|
|
|
httpreq(0);
|
|
|