Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
clearbit
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
prospector
clearbit
Commits
4d4b0986
Commit
4d4b0986
authored
Oct 10, 2014
by
Ben Drucker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a one minute timeout for streaming requests
parent
bec93073
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
client.js
src/client.js
+1
-0
client.js
test/client.js
+17
-0
No files found.
src/client.js
View file @
4d4b0986
...
...
@@ -56,6 +56,7 @@ ClearbitClient.prototype.request = function (options) {
webhook_id
:
options
.
webhook_id
},
options
.
query
),
{
timeout
:
options
.
stream
?
60000
:
5000
,
username
:
this
.
key
,
user_agent
:
'ClearbitNode/v'
+
pkg
.
version
}
...
...
test/client.js
View file @
4d4b0986
...
...
@@ -2,6 +2,8 @@
var
expect
=
require
(
'chai'
).
expect
;
var
nock
=
require
(
'nock'
);
var
sinon
=
require
(
'sinon'
);
var
needle
=
require
(
'needle'
);
var
clearbit
=
require
(
'../'
);
var
Client
=
clearbit
.
Client
;
var
pkg
=
require
(
'../package.json'
);
...
...
@@ -98,6 +100,21 @@ describe('Client', function () {
});
});
it
(
'uses a timeout of 60 seconds for streaming requests'
,
function
()
{
sinon
.
stub
(
needle
,
'request'
).
yieldsAsync
(
null
,
{},
undefined
);
return
client
.
request
({
api
:
'person'
,
stream
:
true
})
.
then
(
function
()
{
expect
(
needle
.
request
.
firstCall
.
args
[
3
])
.
to
.
have
.
property
(
'timeout'
,
60000
);
})
.
finally
(
function
()
{
needle
.
request
.
restore
();
})
});
it
(
'sends a basic auth header'
,
function
()
{
mock
.
get
(
'/v1/people/email/bvdrucker@gmail.com'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment