Skip to content

Commit

Permalink
Enforce axios adapter order, make errors more verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
mainnet-pat authored Aug 28, 2024
1 parent 8e5d49a commit e89e3e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/ts/common/HttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default class HttpClient {
resolve(resp);
}).catch(function(error: AxiosError) {
if (error.response?.status) resolve(error.response);
reject(new Error("Request failed without response: " + method + " " + uri));
reject(new Error("Request failed without response: " + method + " " + uri + " due to underlying error:\n" + error.message + "\n" + error.stack));
});
});

Expand Down Expand Up @@ -185,6 +185,7 @@ export default class HttpClient {
httpsAgent: url.startsWith("https") ? HttpClient.getHttpsAgent() : undefined,
data: body,
transformResponse: res => res,
adapter: ['http', 'xhr', 'fetch'],
}).catch(async (err) => {
if (err.response?.status === 401) {
let authHeader = err.response.headers['www-authenticate'].replace(/,\sDigest.*/, "");
Expand Down Expand Up @@ -231,6 +232,7 @@ export default class HttpClient {
httpsAgent: url.startsWith("https") ? HttpClient.getHttpsAgent() : undefined,
data: body,
transformResponse: res => res,
adapter: ['http', 'xhr', 'fetch'],
});

return finalResponse;
Expand Down

0 comments on commit e89e3e4

Please sign in to comment.