Skip to content

Commit

Permalink
feat: remove trailing slash (#1176)
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-dixit authored Jan 10, 2025
1 parent 9f70e14 commit 77f7dd1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 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
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 77f7dd1

Please sign in to comment.