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

Function echo

packages/effect/test/http/HttpDecompression.test.ts:55–62  ·  view source on GitHub ↗
(accessor: Accessor)

Source from the content-addressed store, hash-verified

53// Echoes the body read through `accessor`, along with the request's
54// Content-Encoding and Content-Length as the app sees them.
55const echo = (accessor: Accessor) => (request: HttpServerRequest.HttpServerRequest) =>
56 Effect.map(readers[accessor](request), (body) =>
57 HttpServerResponse.text(body, {
58 headers: {
59 "x-content-encoding": request.headers["content-encoding"] ?? "",
60 "x-content-length": request.headers["content-length"] ?? ""
61 }
62 }))
63
64const echoApp = (accessor: Accessor) => HttpServerRequest.HttpServerRequest.use(echo(accessor))
65

Callers 2

echoAppFunction · 0.70

Calls 2

textMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected