Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarsh-dixit committed Feb 28, 2025
1 parent 9a6ec0d commit ee70499
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions js/src/sdk/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ describe("Basic SDK spec suite", () => {
expect(axiosInstance1).not.toBe(axiosInstance2);

// Check that the API keys are set correctly in the headers
expect(axiosInstance1.defaults.headers.common["X-API-KEY"]).toBe(
expect(axiosInstance1.defaults.headers["X-API-KEY"]).toBe(
"api_key_1"
);
expect(axiosInstance2.defaults.headers.common["X-API-KEY"]).toBe(
expect(axiosInstance2.defaults.headers["X-API-KEY"]).toBe(
"api_key_2"
);

Expand Down
30 changes: 17 additions & 13 deletions js/src/sdk/models/backendClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ export class AxiosBackendClient {
this.instance = createClient(createConfig({
baseURL: this.baseUrl,
headers: {
"X-API-KEY": `${this.apiKey}`,
"X-SOURCE": "js_sdk",
"X-RUNTIME": this.runtime,
// common: {
"X-API-KEY": `${this.apiKey}`,
"X-SOURCE": "js_sdk",
"X-RUNTIME": this.runtime,
// }
},
}));
if (!apiKey) {
Expand Down Expand Up @@ -90,17 +92,19 @@ export class AxiosBackendClient {
* @private
*/
private initializeApiClient() {
this.instance.setConfig({
baseURL: removeTrailingSlashIfExists(this.baseUrl),
headers: {
"X-API-KEY": `${this.apiKey}`,
"X-SOURCE": "js_sdk",
"X-RUNTIME": this.runtime,
},
throwOnError: true,
});
// this.instance.setConfig({
// baseURL: removeTrailingSlashIfExists(this.baseUrl),
// headers: {
// common: {
// "X-API-KEY": `${this.apiKey}`,
// "X-SOURCE": "js_sdk",
// "X-RUNTIME": this.runtime,
// }
// },
// throwOnError: true,
// });

setAxiosClientConfig(this.instance.instance);
// setAxiosClientConfig(this.instance.instance);
}

getAxiosInstance() {
Expand Down

0 comments on commit ee70499

Please sign in to comment.