Skip to content

Commit

Permalink
Merge pull request #2471 from langchain-ai/brace/drop-trailing-slash
Browse files Browse the repository at this point in the history
fix(sdk-js): remove trailing slash from url
  • Loading branch information
bracesproul authored Nov 19, 2024
2 parents b1779cf + b3fa43e commit 7090d7e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/sdk-js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class BaseClient {

// default limit being capped by Chrome
// https://github.com/nodejs/undici/issues/1373
this.apiUrl = config?.apiUrl || "http://localhost:8123";
// Regex to remove trailing slash, if present
this.apiUrl = config?.apiUrl?.replace(/\/$/, "") || "http://localhost:8123";
this.defaultHeaders = config?.defaultHeaders || {};
if (config?.apiKey != null) {
this.defaultHeaders["X-Api-Key"] = config.apiKey;
Expand Down

0 comments on commit 7090d7e

Please sign in to comment.