We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2458e75 commit b9253d0Copy full SHA for b9253d0
packages/sdk/js/src/client.ts
@@ -24,6 +24,19 @@ export function createOpencodeClient(config?: Config & { directory?: string }) {
24
}
25
26
27
+ if (config?.baseUrl) {
28
+ const baseUrl = new URL(config.baseUrl)
29
+ if (baseUrl.username || baseUrl.password) {
30
+ config.headers = {
31
+ ...config.headers,
32
+ Authorization: `Basic ${btoa(`${baseUrl.username}:${baseUrl.password}`)}`,
33
+ }
34
+ baseUrl.username = ""
35
+ baseUrl.password = ""
36
+ config.baseUrl = baseUrl.toString()
37
38
39
+
40
const client = createClient(config)
41
return new OpencodeClient({ client })
42
0 commit comments