mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 03:45:25 +00:00

The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
30 lines
714 B
JavaScript
30 lines
714 B
JavaScript
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();
|
|
});
|
|
}
|