hyperquest-timeout
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -7,4 +7,5 @@ function timeout(req, ms) { | ||
req.on('response', function() { clearTimeout(t); }); | ||
return req; | ||
} | ||
module.exports = timeout; |
{ | ||
"name": "hyperquest-timeout", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Timeout hyperquests!", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,2 +21,15 @@ hyperquest-timeout | ||
timeout(req, 2000); | ||
``` | ||
Or you can pipe `timeout` as it returns the original `req`: | ||
```js | ||
var hyperquest = require('hyperquest') | ||
, timeout = require('hyperquest-timeout') | ||
; | ||
READABLE_STREAM | ||
.pipe(timeout(hyperquest('http://uploaderthingie.com', 1500))) | ||
.pipe(WRITABLE_STREAM) | ||
; | ||
``` |
@@ -34,1 +34,8 @@ var http = require('http') | ||
}); | ||
test('chaining', function(t) { | ||
timeout(hyperquest('http://localhost:5000/sweet'), 100) | ||
.on('end', function() { | ||
t.ok(true, 'it should allow for chaining') | ||
t.end() | ||
}); | ||
}); |
2664
46
34