Skip to content

Commit

Permalink
feat: remove trailing slash if exist
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-dixit committed Jan 10, 2025
1 parent 8e4f421 commit 806f9e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/src/sdk/client/core/OpenAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type OpenAPIConfig = {
};
};

export const COMPOSIO_BASE_URL = "https://backend.composio.dev/";
export const COMPOSIO_BASE_URL = "https://backend.composio.dev";

export const OpenAPI: OpenAPIConfig = {
BASE: COMPOSIO_BASE_URL,
Expand Down
6 changes: 5 additions & 1 deletion js/src/sdk/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AxiosInstance } from "axios";
import { getUUID } from "../../utils/common";
import logger from "../../utils/logger";
import { getEnvVariable } from "../../utils/shared";
import { removeTrailingSlashIfExists } from "../../utils/string";
import apiClient from "../client/client";
import { client as axiosClient } from "../client/services.gen";
declare module "axios" {
Expand Down Expand Up @@ -117,7 +118,10 @@ export function getSDKConfig(baseUrl?: string, apiKey?: string) {
const apiKeyParsed =
apiKey || getEnvVariable("COMPOSIO_API_KEY") || apiKeyFromUserConfig || "";

return { baseURL: baseURLParsed, apiKey: apiKeyParsed };
return {
baseURL: removeTrailingSlashIfExists(baseURLParsed),
apiKey: apiKeyParsed,
};
}

// Get the API client
Expand Down
2 changes: 2 additions & 0 deletions js/src/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 806f9e1

Please sign in to comment.