@flashbacktech/flashbackclient 0.0.54 → 0.0.56
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/api/client.js +8 -8
- package/package.json +1 -1
package/dist/api/client.js
CHANGED
|
@@ -24,11 +24,6 @@ class ApiClient {
|
|
|
24
24
|
Authorization: `Bearer ${token}`,
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
else {
|
|
28
|
-
this.headers = {
|
|
29
|
-
'Content-Type': 'application/json',
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
27
|
};
|
|
33
28
|
this.authenticate = async (token, provider) => {
|
|
34
29
|
this.setAuthToken(token);
|
|
@@ -87,9 +82,16 @@ class ApiClient {
|
|
|
87
82
|
headers: this.headers,
|
|
88
83
|
body: data ? JSON.stringify(data) : null,
|
|
89
84
|
};
|
|
85
|
+
if (data) {
|
|
86
|
+
options.headers = {
|
|
87
|
+
...options.headers,
|
|
88
|
+
'Content-Type': 'application/json',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
90
91
|
const cleanPath = path.startsWith('/') ? path.substring(1) : path;
|
|
91
92
|
if (this.debug) {
|
|
92
93
|
console.log(`DEBUG: ${method} ${cleanPath} ${JSON.stringify(data)}`);
|
|
94
|
+
console.log(`DEBUG: ${JSON.stringify(this.headers)}`);
|
|
93
95
|
}
|
|
94
96
|
const response = await fetch(`${this.baseURL}/${cleanPath}`, options);
|
|
95
97
|
if (this.debug) {
|
|
@@ -176,9 +178,7 @@ class ApiClient {
|
|
|
176
178
|
return this.makeRequest(`repo/${repoId}/apikey/${keyId}`, 'DELETE', null);
|
|
177
179
|
};
|
|
178
180
|
this.baseURL = baseURL;
|
|
179
|
-
this.headers = {
|
|
180
|
-
'Content-Type': 'application/json',
|
|
181
|
-
};
|
|
181
|
+
this.headers = {};
|
|
182
182
|
this.debug = false;
|
|
183
183
|
}
|
|
184
184
|
}
|