File tree 2 files changed +10
-6
lines changed
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " twitter-api-sdk" ,
3
- "version" : " 1.0.3 " ,
3
+ "version" : " 1.0.4 " ,
4
4
"description" : " A TypeScript SDK for the Twitter API" ,
5
5
"main" : " dist/index.js" ,
6
6
"types" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -46,10 +46,11 @@ export async function request({
46
46
request_body,
47
47
method,
48
48
max_retries,
49
- base_url : baseUrl = "https://api.twitter.com" ,
49
+ base_url = "https://api.twitter.com" ,
50
+ headers,
50
51
...options
51
52
} : RequestOptions ) : Promise < Response > {
52
- const url = new URL ( baseUrl + endpoint ) ;
53
+ const url = new URL ( base_url + endpoint ) ;
53
54
url . search = buildQueryString ( query ) ;
54
55
const isPost = method === "POST" && ! ! request_body ;
55
56
const authHeader = auth
@@ -58,17 +59,20 @@ export async function request({
58
59
const response = await fetchWithRetries (
59
60
url . toString ( ) ,
60
61
{
61
- ...options ,
62
62
headers : {
63
- ...options . headers ,
64
- "User-Agent" : `twitter-api-typescript-sdk/1.0.3` ,
63
+ "User-Agent" : `twitter-api-typescript-sdk/1.0.4` ,
65
64
...( isPost
66
65
? { "Content-Type" : "application/json; charset=utf-8" }
67
66
: undefined ) ,
68
67
...authHeader ,
68
+ ...headers ,
69
69
} ,
70
70
method,
71
71
body : isPost ? JSON . stringify ( request_body ) : undefined ,
72
+ // Timeout if you don't see any data for 60 seconds
73
+ // https://developer.twitter.com/en/docs/tutorials/consuming-streaming-data
74
+ timeout : 60000 ,
75
+ ...options ,
72
76
} ,
73
77
max_retries
74
78
) ;
You can’t perform that action at this time.
0 commit comments