Skip to content

Commit

Permalink
fix: set Authorization instead of overriding headers
Browse files Browse the repository at this point in the history
This change ensures compatibility with Axios 1.x's AxiosRequestHeaders type
and resolves TypeScript type mismatch issues.
  • Loading branch information
cat2608 committed Dec 1, 2023
1 parent c6cb40c commit 9fc9cda
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/snyk/advisor/services/advisorApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ export class AdvisorApiClient implements IAdvisorApiClient {
const token = await this.configuration.getToken();
this.http.interceptors.request.use(req => {
req.baseURL = this.configuration.baseApiUrl;
req.headers = {
...req.headers,
Authorization: `token ${token}`,
} as { [header: string]: string };

req.headers['Authorization'] = `token ${token}`;
return req;
});
return this.http.post<T, R>(url, data, config);
Expand Down

0 comments on commit 9fc9cda

Please sign in to comment.