Skip to content

Instantly share code, notes, and snippets.

@jonDowdle
Created December 14, 2014 14:34
Show Gist options
  • Save jonDowdle/fc8bfa7962efb7db6ac0 to your computer and use it in GitHub Desktop.
Save jonDowdle/fc8bfa7962efb7db6ac0 to your computer and use it in GitHub Desktop.
var needle = require('needle');
function testRequest( timeout ) {
needle.get(
'https://person.clearbit.com/v1/people/email/alex@alexmaccaw.com',
{
username: 'REDACTED',
password: '',
user_agent: 'ClearbitNode/v1.0.4',
timeout: timeout
},
function(error, response) {
if (!error && response.statusCode == 200) {
console.log( "Success with timeout %d", timeout );
console.log( "Status code", response.statusCode );
}
else {
console.warn( "ERROR with timeout %d: %j", timeout, error );
testRequest( timeout + 100 );
}
}
);
}
testRequest( 5000 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment