File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -84,22 +84,22 @@ export async function request({
84
84
} : RequestOptions ) : Promise < Response > {
85
85
const url = new URL ( base_url + endpoint ) ;
86
86
url . search = buildQueryString ( query ) ;
87
- const isPost = method === "POST" && ! ! request_body ;
87
+ const includeBody = ( method === "POST" || method === "PUT" ) && ! ! request_body ;
88
88
const authHeader = auth
89
89
? await auth . getAuthHeader ( url . href , method )
90
90
: undefined ;
91
91
const response = await fetchWithRetries (
92
92
url . toString ( ) ,
93
93
{
94
94
headers : {
95
- ...( isPost
95
+ ...( includeBody
96
96
? { "Content-Type" : "application/json; charset=utf-8" }
97
97
: undefined ) ,
98
98
...authHeader ,
99
99
...headers ,
100
100
} ,
101
101
method,
102
- body : isPost ? JSON . stringify ( request_body ) : undefined ,
102
+ body : includeBody ? JSON . stringify ( request_body ) : undefined ,
103
103
// Timeout if you don't see any data for 60 seconds
104
104
// https://developer.twitter.com/en/docs/tutorials/consuming-streaming-data
105
105
timeout : 60000 ,
You can’t perform that action at this time.
0 commit comments