Fix URL parsing for relative paths in SDK client

This commit is contained in:
Andrew Joslin 2025-11-25 08:02:16 -08:00
parent 126f2b0600
commit de08ba0064

View file

@ -24,7 +24,7 @@ export function createOpencodeClient(config?: Config & { directory?: string }) {
}
}
if (config?.baseUrl) {
if (config?.baseUrl && /^https?:\/\//.test(config.baseUrl)) {
const baseUrl = new URL(config.baseUrl)
if (baseUrl.username || baseUrl.password) {
config.headers = {