mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 11:04:30 +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>
31 lines
728 B
JavaScript
31 lines
728 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var http = require('http');
|
|
var net = require('net');
|
|
|
|
var s = http.createServer(function(req, res) {
|
|
res.statusCode = 200;
|
|
res.statusMessage = 'Custom Message';
|
|
res.end('');
|
|
});
|
|
|
|
s.listen(common.PORT, test);
|
|
|
|
|
|
function test() {
|
|
var bufs = [];
|
|
var client = net.connect(common.PORT, function() {
|
|
client.write('GET / HTTP/1.1\r\nConnection: close\r\n\r\n');
|
|
});
|
|
client.on('data', function(chunk) {
|
|
bufs.push(chunk);
|
|
});
|
|
client.on('end', function() {
|
|
var head = Buffer.concat(bufs).toString('binary').split('\r\n')[0];
|
|
assert.equal('HTTP/1.1 200 Custom Message', head);
|
|
console.log('ok');
|
|
s.close();
|
|
});
|
|
}
|