setting timeout via defaults doesn't work on node 0.4 #219

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+11 −1
Split
View
@@ -7,7 +7,7 @@ var server = require('./server')
var s = server.createServer();
var expectedBody = "waited";
-var remainingTests = 5;
+var remainingTests = 6;
s.listen(s.port, function () {
// Request that waits for 200ms
@@ -77,6 +77,16 @@ s.listen(s.port, function () {
checkDone();
})
+ // Set timeout via defaults
+ var o = {
+ url: s.url + "/timeout"
+ }
+ var r = request.defaults({timeout: 50});
+ r(o, function (err, resp, body) {
+ assert.equal(err.code, "ETIMEDOUT");
+ checkDone();
+ })
+
function checkDone() {
if(--remainingTests == 0) {
s.close();