MCPcopy
hub / github.com/anomalyco/opencode / post

Function post

packages/core/src/plugin/provider/opencode.ts:297–311  ·  view source on GitHub ↗
(
  http: HttpClient.HttpClient,
  url: string,
  body: Record<string, string>,
  schema: S,
  statusOk = true,
)

Source from the content-addressed store, hash-verified

295}
296
297function post<S extends Schema.Top>(
298 http: HttpClient.HttpClient,
299 url: string,
300 body: Record<string, string>,
301 schema: S,
302 statusOk = true,
303) {
304 return HttpClientRequest.post(url).pipe(
305 HttpClientRequest.acceptJson,
306 HttpClientRequest.schemaBodyJson(Schema.Record(Schema.String, Schema.String))(body),
307 Effect.flatMap((request) => http.execute(request)),
308 Effect.flatMap((response) => (statusOk ? HttpClientResponse.filterStatusOk(response) : Effect.succeed(response))),
309 Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)),
310 )
311}

Callers 2

oauthFunction · 0.70
loopFunction · 0.70

Calls 1

executeMethod · 0.65

Tested by

no test coverage detected