0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-http-exceptions.js
Rich Trott c89b6ee347 test: favor strict equality in http tests
PR-URL: https://github.com/nodejs/node/pull/8151
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-19 16:30:28 -07:00

26 lines
651 B
JavaScript

'use strict';
require('../common');
var http = require('http');
var server = http.createServer(function(req, res) {
intentionally_not_defined(); // eslint-disable-line no-undef
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Thank you, come again.');
res.end();
});
server.listen(0, function() {
for (var i = 0; i < 4; i += 1) {
http.get({ port: this.address().port, path: '/busy/' + i });
}
});
var exception_count = 0;
process.on('uncaughtException', function(err) {
console.log('Caught an exception: ' + err);
if (err.name === 'AssertionError') throw err;
if (++exception_count === 4) process.exit(0);
});