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

Function request

packages/opencode/test/server/httpapi-session.test.ts:209–215  ·  view source on GitHub ↗
(path: string, init?: RequestInit)

Source from the content-addressed store, hash-verified

207 })
208
209function request(path: string, init?: RequestInit) {
210 const url = new URL(path, "http://localhost")
211 return HttpClientRequest.fromWeb(new Request(url, init)).pipe(
212 HttpClientRequest.setUrl(url.pathname),
213 HttpClient.execute,
214 )
215}
216
217function json<T>(response: HttpClientResponse.HttpClientResponse) {
218 if (response.status !== 200) return response.text.pipe(Effect.flatMap((text) => Effect.die(new Error(text))))

Callers 3

requestJsonFunction · 0.70
recordPromptFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected