fix: base url

This commit is contained in:
kolaente 2025-07-21 11:59:21 +02:00
parent 97c3e59821
commit 60057ccf6b
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
1 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,8 @@ class HttpClient {
private buildUrl(config: RequestConfig) { private buildUrl(config: RequestConfig) {
let url = config.url let url = config.url
if (!url.startsWith('http')) { if (!url.startsWith('http')) {
url = (config.baseURL ?? this.baseURL ?? '') + url const baseURL = config.baseURL ?? this.baseURL ?? ''
url = baseURL + (baseURL.endsWith('/') || url.startsWith('/') ? '' : '/') + url
} }
if (config.params) { if (config.params) {
const qs = new URLSearchParams(config.params as Record<string, string>).toString() const qs = new URLSearchParams(config.params as Record<string, string>).toString()