Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Is there a option that i reset default timeout for request #13

Closed
cmingxu opened this Issue · 4 comments

4 participants

@cmingxu

I want a place to set timeout for requests, node default timeout kind of too long for my scenario.

@ejfinneran

@cmingxu I was just looking for the same functionality. I'm playing around with how best to implement this. Can you take a look at my fork and see if you would do things differently?

My fork currently works this way:

  • You call the timeout method and pass the number of milliseconds you want to wait.
  • If the timeout is reach before the request is completed, req.abort() is called
  • The standard callback is triggered with err set to ECONNRESET and resp/body set to null.

Thoughts?

https://github.com/ejfinneran/node-scoped-http-client/tree/timeout-support

client = ScopedClient.create('http://10.255.255.1:9999');

client.timeout(100);

client.get()(function(err, resp, body) {
  if (err) {
    util.puts("ERROR: " + err);
   }
});
@drdamour

@ejfinneran +1 for your solution's syntax, but your fork seems to be missing

@ejfinneran

@drdamour Whoops! I had done some repo house cleaning and forgot I had that branch but I just restored it.

@pseudomuto

Anyone still looking at this?

@technoweenie technoweenie closed this in #15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.