mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 06:08:50 +02: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>
37 lines
917 B
JavaScript
37 lines
917 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var net = require('net');
|
|
var http = require('http');
|
|
var url = require('url');
|
|
|
|
// Make sure no exceptions are thrown when receiving malformed HTTP
|
|
// requests.
|
|
|
|
var nrequests_completed = 0;
|
|
var nrequests_expected = 1;
|
|
|
|
var server = http.createServer(function(req, res) {
|
|
console.log('req: ' + JSON.stringify(url.parse(req.url)));
|
|
|
|
res.writeHead(200, {'Content-Type': 'text/plain'});
|
|
res.write('Hello World');
|
|
res.end();
|
|
|
|
if (++nrequests_completed == nrequests_expected) server.close();
|
|
});
|
|
server.listen(common.PORT);
|
|
|
|
server.on('listening', function() {
|
|
var c = net.createConnection(common.PORT);
|
|
c.on('connect', function() {
|
|
c.write('GET /hello?foo=%99bar HTTP/1.1\r\n\r\n');
|
|
c.end();
|
|
});
|
|
|
|
// TODO add more!
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(nrequests_expected, nrequests_completed);
|
|
});
|