MCPcopy Index your code
hub / github.com/anomalyco/opencode / request

Function request

packages/opencode/test/server/httpapi-file.test.ts:12–25  ·  view source on GitHub ↗
(route: string, directory: string, query?: Record<string, string>)

Source from the content-addressed store, hash-verified

10const context = Context.empty() as Context.Context<unknown>
11
12function request(route: string, directory: string, query?: Record<string, string>) {
13 const url = new URL(`http://localhost${route}`)
14 for (const [key, value] of Object.entries(query ?? {})) {
15 url.searchParams.set(key, value)
16 }
17 return HttpApiApp.webHandler().handler(
18 new Request(url, {
19 headers: {
20 "x-opencode-directory": directory,
21 },
22 }),
23 context,
24 )
25}
26
27afterEach(async () => {
28 await disposeAllInstances()

Callers 1

Calls 1

setMethod · 0.45

Tested by

no test coverage detected