Skip to content

Commit

Permalink
Merge branch 'master' into ft-vercel-get-tool-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-dixit authored Jan 10, 2025
2 parents 755d346 + 77f7dd1 commit d42dfda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/src/sdk/models/backendClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { client as axiosClient } from "../client/services.gen";
import { setAxiosClientConfig } from "../utils/config";
import { CEG } from "../utils/error";
import { COMPOSIO_SDK_ERROR_CODES } from "../utils/errors/src/constants";
import { removeTrailingSlashIfExists } from "../utils/string";

/**
* Class representing the details required to initialize and configure the API client.
Expand Down Expand Up @@ -35,7 +36,7 @@ export class BackendClient {
constructor(apiKey: string, baseUrl: string, runtime?: string) {
this.runtime = runtime || "";
this.apiKey = apiKey;
this.baseUrl = baseUrl;
this.baseUrl = removeTrailingSlashIfExists(baseUrl);
this.instance = axiosClient.instance;

if (!apiKey) {
Expand Down Expand Up @@ -84,7 +85,7 @@ export class BackendClient {
*/
private initializeApiClient() {
axiosClient.setConfig({
baseURL: this.baseUrl,
baseURL: removeTrailingSlashIfExists(this.baseUrl),
headers: {
"X-API-KEY": `${this.apiKey}`,
"X-SOURCE": "js_sdk",
Expand Down
2 changes: 2 additions & 0 deletions js/src/sdk/utils/string.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const removeTrailingSlashIfExists = (str: string) =>
str.replace(/\/+$/, "");

0 comments on commit d42dfda

Please sign in to comment.