whisperai-sdk 1.0.0 → 1.0.1
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/index.js +4 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -149,6 +149,7 @@ class WhisperClient {
|
|
|
149
149
|
get requestOptions() {
|
|
150
150
|
return {
|
|
151
151
|
headers: {
|
|
152
|
+
"cache-control": "no-cache",
|
|
152
153
|
Cookie: this.cookies
|
|
153
154
|
}
|
|
154
155
|
};
|
|
@@ -159,9 +160,8 @@ class WhisperClient {
|
|
|
159
160
|
await this.login();
|
|
160
161
|
return await this.handleRequest(call());
|
|
161
162
|
} catch (error) {
|
|
162
|
-
if (error.code !== "AUTH_ERROR")
|
|
163
|
+
if (error.code !== "AUTH_ERROR")
|
|
163
164
|
throw error;
|
|
164
|
-
}
|
|
165
165
|
await this.login();
|
|
166
166
|
return this.handleRequest(call());
|
|
167
167
|
}
|
|
@@ -169,15 +169,14 @@ class WhisperClient {
|
|
|
169
169
|
async handleRequest(request) {
|
|
170
170
|
try {
|
|
171
171
|
const response = await request;
|
|
172
|
-
this.cookies =
|
|
172
|
+
this.cookies = response.headers["set-cookie"];
|
|
173
173
|
return response.data;
|
|
174
174
|
} catch (err) {
|
|
175
|
-
console.log("err", err);
|
|
176
175
|
if (axios.isAxiosError(err)) {
|
|
177
176
|
if (!err.response) {
|
|
178
177
|
throw new WhisperNetworkError(err);
|
|
179
178
|
}
|
|
180
|
-
if (err.response.status === 401) {
|
|
179
|
+
if (err.response.status === 401 || err.response.status === 403) {
|
|
181
180
|
throw new WhisperAuthError;
|
|
182
181
|
}
|
|
183
182
|
throw new WhisperApiError(err.response.status, err.response.data);
|
package/package.json
CHANGED