glitch-javascript-sdk 1.4.7 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +3 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +3 -6
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/util/Requests.ts +11 -13
package/package.json
CHANGED
package/src/util/Requests.ts
CHANGED
|
@@ -202,35 +202,32 @@ class Requests {
|
|
|
202
202
|
.join('&');
|
|
203
203
|
url = `${url}?${queryString}`;
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
|
|
206
206
|
// Prepare FormData
|
|
207
207
|
const formData = new FormData();
|
|
208
208
|
formData.append(filename, blob);
|
|
209
|
-
|
|
209
|
+
|
|
210
210
|
if (Requests.community_id) {
|
|
211
211
|
data = {
|
|
212
212
|
...data,
|
|
213
213
|
communities: [Requests.community_id],
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
|
-
|
|
216
|
+
|
|
217
217
|
for (let key in data) {
|
|
218
218
|
formData.append(key, data[key]);
|
|
219
219
|
}
|
|
220
|
-
|
|
220
|
+
|
|
221
221
|
// Prepare headers
|
|
222
|
-
let headers: { [key: string]: string } = {
|
|
223
|
-
|
|
224
|
-
};
|
|
225
|
-
|
|
222
|
+
let headers: { [key: string]: string } = {};
|
|
223
|
+
|
|
226
224
|
if (Requests.authToken) {
|
|
227
225
|
headers['Authorization'] = `Bearer ${Requests.authToken}`;
|
|
228
226
|
}
|
|
229
|
-
|
|
230
|
-
// Format URL
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
227
|
+
|
|
228
|
+
// Format URL correctly
|
|
229
|
+
const uri = Requests.baseUrl.replace(/\/+$/, '') + '/' + url.replace(/^\/+/, '');
|
|
230
|
+
|
|
234
231
|
// Make the request
|
|
235
232
|
return axios({
|
|
236
233
|
method: 'POST',
|
|
@@ -240,6 +237,7 @@ class Requests {
|
|
|
240
237
|
onUploadProgress,
|
|
241
238
|
});
|
|
242
239
|
}
|
|
240
|
+
|
|
243
241
|
|
|
244
242
|
|
|
245
243
|
// Method adapted for browser environments
|