(effect: Effect.Effect<A, E, R>)
| 158 | const scopeEjected = Symbol.for("effect/http/HttpEffect/scopeEjected") |
| 159 | |
| 160 | const scoped = <A, E, R>(effect: Effect.Effect<A, E, R>) => |
| 161 | Effect.withFiber((fiber) => { |
| 162 | const scope = Scope.makeUnsafe() |
| 163 | const prevServices = fiber.context |
| 164 | fiber.setContext(Context.add(fiber.context, Scope.Scope, scope)) |
| 165 | return Effect.onExitPrimitive(effect, (exit) => { |
| 166 | fiber.setContext(prevServices) |
| 167 | if (scopeEjected in scope) return undefined |
| 168 | return Scope.closeUnsafe(scope, exit) |
| 169 | }, true) |
| 170 | }) |
| 171 | |
| 172 | /** |
| 173 | * Function run with the current request and response just before the response is sent, allowing the response to be replaced or failing with `HttpServerError`. |
no test coverage detected
searching dependent graphs…