fix(opencode): add authorization header to fetch requests in RunCommand (#29877)

This commit is contained in:
OpeOginni 2026-06-13 21:13:15 +02:00 committed by GitHub
parent a6e3afe048
commit 632f94fa68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -840,7 +840,12 @@ export const RunCommand = effectCmd({
const fetchFn = (async (input: RequestInfo | URL, init?: RequestInit) => {
const { Server } = await import("@/server/server")
const request = new Request(input, init)
return Server.Default().app.fetch(request)
const headers = new Headers(request.headers)
const auth = ServerAuth.header()
if (auth) headers.set("Authorization", auth)
return Server.Default().app.fetch(
new Request(request, { headers }),
)
}) as typeof globalThis.fetch
try {
@ -875,7 +880,12 @@ export const RunCommand = effectCmd({
const fetchFn = (async (input: RequestInfo | URL, init?: RequestInit) => {
const { Server } = await import("@/server/server")
const request = new Request(input, init)
return Server.Default().app.fetch(request)
const headers = new Headers(request.headers)
const auth = ServerAuth.header()
if (auth) headers.set("Authorization", auth)
return Server.Default().app.fetch(
new Request(request, { headers }),
)
}) as typeof globalThis.fetch
const sdk = createOpencodeClient({
baseUrl: "http://opencode.internal",