mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 18:02:21 +00:00

Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
40 lines
874 B
JavaScript
40 lines
874 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
var http = require('http');
|
|
|
|
// This test is to make sure that when the HTTP server
|
|
// responds to a HEAD request with data to res.end,
|
|
// it does not send any body.
|
|
|
|
var server = http.createServer(function(req, res) {
|
|
res.writeHead(200);
|
|
res.end('FAIL'); // broken: sends FAIL from hot path.
|
|
});
|
|
server.listen(common.PORT);
|
|
|
|
var responseComplete = false;
|
|
|
|
server.on('listening', function() {
|
|
var req = http.request({
|
|
port: common.PORT,
|
|
method: 'HEAD',
|
|
path: '/'
|
|
}, function(res) {
|
|
common.error('response');
|
|
res.on('end', function() {
|
|
common.error('response end');
|
|
server.close();
|
|
responseComplete = true;
|
|
});
|
|
res.resume();
|
|
});
|
|
common.error('req');
|
|
req.end();
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.ok(responseComplete);
|
|
});
|