-
-
Save jonDowdle/fc8bfa7962efb7db6ac0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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