mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 23:43:09 +01:00
f29762f4dd
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
884 B
JavaScript
40 lines
884 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, it does not send any body.
|
|
// In this case it was sending '0\r\n\r\n'
|
|
|
|
var server = http.createServer(function(req, res) {
|
|
res.writeHead(200); // broken: defaults to TE chunked
|
|
res.end();
|
|
});
|
|
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);
|
|
});
|