Skip to content

Instantly share code, notes, and snippets.

@Kami
Created December 1, 2010 20:45
Show Gist options
  • Select an option

  • Save Kami/724188 to your computer and use it in GitHub Desktop.

Select an option

Save Kami/724188 to your computer and use it in GitHub Desktop.
exports['PUT bar@1.0.tar.gz'] = function(assert, beforeExit) {
var n = 0;
ps.on('bundles listed', function() {
var req = {
url: '/bundles/bar/bar@1.0.tar.gz',
method: 'PUT',
headers: {
'Transfer-Encoding': 'chunked'
},
streamer: function(request) {
var intervalId;
function write_some() {
request.write(misc.randstr(1024));
if (++n === 1000) {
clearInterval(intervalId);
request.end();
}
}
intervalId = setInterval(write_some, 2);
}
};
assert.response(getServer(), req, function(res) {
n++;
assert.equal(500, res.statusCode);
});
});
beforeExit(function() {
console.log(n);
assert.equal(1001, n, 'Responses Received');
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment