mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
3e1b1dd4a9
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.
41 lines
887 B
JavaScript
41 lines
887 B
JavaScript
var assert = require('assert');
|
|
var common = require('../common.js');
|
|
var http = require('http');
|
|
|
|
var start;
|
|
var server = http.createServer(function(req, res) {
|
|
req.resume();
|
|
req.on('end', function() {
|
|
res.end('Success');
|
|
});
|
|
|
|
server.close();
|
|
});
|
|
|
|
server.listen(common.PORT, 'localhost', function() {
|
|
var interval_id = setInterval(function() {
|
|
start = new Date();
|
|
if (start.getMilliseconds() > 100)
|
|
return;
|
|
|
|
console.log(start.toISOString());
|
|
var req = http.request({
|
|
'host': 'localhost',
|
|
'port': common.PORT,
|
|
'agent': false,
|
|
'method': 'PUT'
|
|
});
|
|
|
|
req.end('Test');
|
|
clearInterval(interval_id);
|
|
}, 10);
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
var end = new Date();
|
|
console.log(end.toISOString());
|
|
assert.equal(start.getSeconds(), end.getSeconds());
|
|
assert(end.getMilliseconds() < 900);
|
|
console.log('ok');
|
|
});
|