Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
test: Fix many tests for http streams2 refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Dec 15, 2012
1 parent 1d36931 commit 0977638
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions test/simple/test-cluster-http-pipe.js
Expand Up @@ -53,6 +53,7 @@ http.createServer(function(req, res) {
}).listen(common.PIPE, function() {
var self = this;
http.get({ socketPath: common.PIPE, path: '/' }, function(res) {
res.resume();
res.on('end', function(err) {
if (err) throw err;
process.send('DONE');
Expand Down
1 change: 1 addition & 0 deletions test/simple/test-domain-http-server.js
Expand Up @@ -33,6 +33,7 @@ var disposeEmit = 0;

var server = http.createServer(function(req, res) {
var dom = domain.create();
req.resume();
dom.add(req);
dom.add(res);

Expand Down
10 changes: 9 additions & 1 deletion test/simple/test-http-abort-client.js
Expand Up @@ -46,13 +46,21 @@ server.listen(common.PORT, function() {

res.on('data', function(chunk) {
console.log('Read ' + chunk.length + ' bytes');
console.log(chunk.toString());
console.log(' chunk=%j', chunk.toString());
});

res.on('end', function() {
console.log('Response ended.');
});

res.on('aborted', function() {
console.log('Response aborted.');
});

res.socket.on('close', function() {
console.log('socket closed, but not res');
})

// it would be nice if this worked:
res.on('close', function() {
console.log('Response aborted');
Expand Down
1 change: 1 addition & 0 deletions test/simple/test-http-client-agent.js
Expand Up @@ -61,6 +61,7 @@ function request(i) {
server.close();
}
});
res.resume();
});
}

Expand Down
5 changes: 3 additions & 2 deletions test/simple/test-http-client-pipe-end.js
Expand Up @@ -26,6 +26,7 @@ var assert = require('assert');
var http = require('http');

var server = http.createServer(function(req, res) {
req.resume();
req.once('end', function() {
res.writeHead(200);
res.end();
Expand All @@ -50,9 +51,9 @@ server.listen(common.PIPE, function() {
function sched(cb, ticks) {
function fn() {
if (--ticks)
process.nextTick(fn);
setImmediate(fn);
else
cb();
}
process.nextTick(fn);
setImmediate(fn);
}

0 comments on commit 0977638

Please sign in to comment.