fix(agent): fix the endpoint config to always remove trailing slash. (#2472)

* fix(agent): fix the endpoint config to always remove trailing slash.

* fix(agent): fix lint.
This commit is contained in:
Zhiming Ma 2024-06-21 21:32:40 +08:00 committed by GitHub
parent 64a4df227a
commit 4855d23660
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,6 +96,7 @@ export class TabbyAgent extends EventEmitter implements Agent {
this.clientConfig,
this.serverProvidedConfig,
) as AgentConfig;
this.config.server.endpoint = this.config.server.endpoint.replace(/\/+$/, ""); // remove trailing slash
this.logger.trace("Updated config:", this.config);
if (fileLogger) {
@ -153,7 +154,7 @@ export class TabbyAgent extends EventEmitter implements Agent {
? `Bearer ${this.auth.token}`
: undefined;
this.api = createClient<TabbyApi>({
baseUrl: this.config.server.endpoint.replace(/\/+$/, ""), // remove trailing slash
baseUrl: this.config.server.endpoint,
headers: {
Authorization: auth,
...this.config.server.requestHeaders,