fix(opencode): add authorization header to fetch requests in RunCommand (#29877)
This commit is contained in:
parent
a6e3afe048
commit
632f94fa68
@ -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",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user