Please sign in to comment.
Support adding a basic timeout to requests
- If the timeout is trigger req.abort() is called. - Also had to add an extra listener to ensure that the standard callback is called even if the connection ends in an error.
- Loading branch information...
Showing with 36 additions and 0 deletions.
|@@ -0,0 +1,13 @@|
|+ScopedClient = require '../lib'|
|+http = require 'http'|
|+assert = require 'assert'|
|+called = 0|
|+client = ScopedClient.create 'http://10.255.255.1:9999'|
|+client.get() (err, resp, body) ->|
|+ called++ if err|
|+process.on 'exit', ->|
|+ assert.equal 1, called|