|
@ -12,7 +12,7 @@ var badRequests = 0; |
|
|
var parts = {}; |
|
|
var parts = {}; |
|
|
var respond = function(res, text) { |
|
|
var respond = function(res, text) { |
|
|
requests++; |
|
|
requests++; |
|
|
if (requests == 3) { |
|
|
if (requests == 4) { |
|
|
server.close(); |
|
|
server.close(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -29,6 +29,7 @@ var server = http.createServer(function(req, res) { |
|
|
}) |
|
|
}) |
|
|
.addErrback(function() { |
|
|
.addErrback(function() { |
|
|
badRequests++; |
|
|
badRequests++; |
|
|
|
|
|
respond(res, 'no thanks'); |
|
|
}); |
|
|
}); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -88,9 +89,13 @@ var badRequest = client.request('POST', '/', {'Content-Type': 'something', 'Cont |
|
|
badRequest.sendBody(fixture.reply, 'binary'); |
|
|
badRequest.sendBody(fixture.reply, 'binary'); |
|
|
badRequest.finish(); |
|
|
badRequest.finish(); |
|
|
|
|
|
|
|
|
|
|
|
var simpleBadRequest = client.request('POST', '/', {'X-Use-Simple-Api': 'yes', 'Content-Type': 'something', 'Content-Length': fixture.reply.length}); |
|
|
|
|
|
simpleBadRequest.sendBody(fixture.reply, 'binary'); |
|
|
|
|
|
simpleBadRequest.finish(); |
|
|
|
|
|
|
|
|
process.addListener('exit', function() { |
|
|
process.addListener('exit', function() { |
|
|
puts("done"); |
|
|
puts("done"); |
|
|
assert.equal(2, parts_complete); |
|
|
assert.equal(2, parts_complete); |
|
|
assert.equal(2, parts_reveived); |
|
|
assert.equal(2, parts_reveived); |
|
|
assert.equal(1, badRequests); |
|
|
assert.equal(2, badRequests); |
|
|
}); |
|
|
}); |