MCPcopy
hub / github.com/Effect-TS/effect / appendPreResponseHandler

Function appendPreResponseHandler

packages/platform/src/internal/httpApp.ts:15–27  ·  view source on GitHub ↗
(
  handler: PreResponseHandler
)

Source from the content-addressed store, hash-verified

13
14/** @internal */
15export const appendPreResponseHandler: (handler: PreResponseHandler) => Effect.Effect<void> = (
16 handler: PreResponseHandler
17) =>
18 FiberRef.update(
19 currentPreResponseHandlers,
20 Option.match({
21 onNone: () => Option.some(handler),
22 onSome: (prev) =>
23 Option.some((request, response) =>
24 Effect.flatMap(prev(request, response), (response) => handler(request, response))
25 )
26 })
27 )
28
29/** @internal */
30export const withPreResponseHandler = dual<

Callers

nothing calls this directly

Calls 3

updateMethod · 0.65
prevFunction · 0.50
handlerFunction · 0.50

Tested by

no test coverage detected