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

Function trackResponse

packages/effect/src/http/HttpClient.ts:2434–2451  ·  view source on GitHub ↗
(
  response: HttpClientResponse.HttpClientResponse,
  controller: AbortController,
  scoped: boolean,
  urlParamsRedactedNames: ReadonlyArray<string | RegExp>,
  redactedPath: ClientPath | undefined
)

Source from the content-addressed store, hash-verified

2432const responseControllers = new WeakMap<HttpClientResponse.HttpClientResponse, AbortController>()
2433
2434const trackResponse = (
2435 response: HttpClientResponse.HttpClientResponse,
2436 controller: AbortController,
2437 scoped: boolean,
2438 urlParamsRedactedNames: ReadonlyArray<string | RegExp>,
2439 redactedPath: ClientPath | undefined
2440): HttpClientResponse.HttpClientResponse => {
2441 // Body readers create errors with the runner's response, while callers hold
2442 // the wrapper, so both carry the names of the executing fiber.
2443 Error.addResponseRedactedNames(response, urlParamsRedactedNames, redactedPath)
2444 if (!scoped) {
2445 responseRegistry.register(response, controller)
2446 response = new InterruptibleResponse(response, controller)
2447 Error.addResponseRedactedNames(response, urlParamsRedactedNames, redactedPath)
2448 }
2449 responseControllers.set(response, controller)
2450 return response
2451}
2452
2453class InterruptibleResponse implements HttpClientResponse.HttpClientResponse, Pipeable {
2454 readonly original: HttpClientResponse.HttpClientResponse

Callers 1

exchangeFunction · 0.85

Calls 2

setMethod · 0.65
registerMethod · 0.45

Tested by

no test coverage detected