node/test/parallel/test-http-client-req-error-dont-double-fire.js
Tobias Nießen 467385a49b test: use invalid host according to RFC2606
PR-URL: https://github.com/nodejs/node/pull/14863
Refs: https://github.com/nodejs/node/pull/14781
Refs: https://tools.ietf.org/html/rfc2606#section-2
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2017-08-19 00:08:37 +02:00

17 lines
466 B
JavaScript

'use strict';
const assert = require('assert');
const http = require('http');
const common = require('../common');
// Invalid hostname as per https://tools.ietf.org/html/rfc2606#section-2
const host = 'this.hostname.is.invalid';
const req = http.get({ host });
const err = new Error('mock unexpected code error');
req.on('error', common.mustCall(() => {
throw err;
}));
process.on('uncaughtException', common.mustCall((e) => {
assert.strictEqual(e, err);
}));