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

Function withScope

packages/effect/src/unstable/http/HttpClient.ts:1516–1529  ·  view source on GitHub ↗
(
  self: HttpClient.With<E, R>
)

Source from the content-addressed store, hash-verified

1514 * @since 4.0.0
1515 */
1516export const withScope = <E, R>(
1517 self: HttpClient.With<E, R>
1518): HttpClient.With<E, R | Scope.Scope> =>
1519 transform(
1520 self,
1521 (effect, request) => {
1522 const controller = new AbortController()
1523 scopedRequests.set(request, controller)
1524 return Effect.andThen(
1525 Effect.addFinalizer(() => Effect.sync(() => controller.abort())),
1526 effect
1527 )
1528 }
1529 )
1530
1531/**
1532 * Enables following HTTP redirects up to a specified number of times.

Callers

nothing calls this directly

Calls 5

addFinalizerMethod · 0.80
abortMethod · 0.80
transformFunction · 0.70
setMethod · 0.65
syncMethod · 0.45

Tested by

no test coverage detected