mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-26 13:23:34 +00:00
fix(opencode): add authorization header to fetch requests in RunCommand (#29877)
This commit is contained in:
parent
a6e3afe048
commit
632f94fa68
1 changed files with 12 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue