MCPcopy Create free account
hub / github.com/Effect-TS/effect / post

Function post

packages/effect/test/http/HttpDecompression.test.ts:28–40  ·  view source on GitHub ↗
(
  handler: (request: Request) => Promise<Response>,
  body: Uint8Array | string,
  headers?: Record<string, string>,
  path = "/"
)

Source from the content-addressed store, hash-verified

26}
27
28const post = (
29 handler: (request: Request) => Promise<Response>,
30 body: Uint8Array | string,
31 headers?: Record<string, string>,
32 path = "/"
33) =>
34 handler(
35 new Request(`http://localhost${path}`, {
36 method: "POST",
37 body: body as BodyInit,
38 ...(headers === undefined ? {} : { headers })
39 })
40 )
41
42const readers = {
43 json: (request: HttpServerRequest.HttpServerRequest) => Effect.map(request.json, (json) => JSON.stringify(json)),

Callers 1

Calls 1

handlerFunction · 0.50

Tested by

no test coverage detected