| 2451 | } |
| 2452 | |
| 2453 | class InterruptibleResponse implements HttpClientResponse.HttpClientResponse, Pipeable { |
| 2454 | readonly original: HttpClientResponse.HttpClientResponse |
| 2455 | readonly controller: AbortController |
| 2456 | |
| 2457 | constructor( |
| 2458 | original: HttpClientResponse.HttpClientResponse, |
| 2459 | controller: AbortController |
| 2460 | ) { |
| 2461 | this.original = original |
| 2462 | this.controller = controller |
| 2463 | } |
| 2464 | |
| 2465 | readonly [HttpClientResponse.TypeId] = HttpClientResponse.TypeId |
| 2466 | readonly [HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId |
| 2467 | |
| 2468 | private applyInterrupt<A, E, R>(effect: Effect.Effect<A, E, R>) { |
| 2469 | return Effect.suspend(() => { |
| 2470 | responseRegistry.unregister(this.original) |
| 2471 | return Effect.onInterrupt( |
| 2472 | effect, |
| 2473 | () => |
| 2474 | Effect.sync(() => { |
| 2475 | this.controller.abort() |
| 2476 | }) |
| 2477 | ) |
| 2478 | }) |
| 2479 | } |
| 2480 | |
| 2481 | get request() { |
| 2482 | return this.original.request |
| 2483 | } |
| 2484 | |
| 2485 | get url() { |
| 2486 | return this.original.url |
| 2487 | } |
| 2488 | |
| 2489 | get status() { |
| 2490 | return this.original.status |
| 2491 | } |
| 2492 | |
| 2493 | get headers() { |
| 2494 | return this.original.headers |
| 2495 | } |
| 2496 | |
| 2497 | get cookies() { |
| 2498 | return this.original.cookies |
| 2499 | } |
| 2500 | |
| 2501 | get remoteAddress() { |
| 2502 | return this.original.remoteAddress |
| 2503 | } |
| 2504 | |
| 2505 | get formData() { |
| 2506 | return this.applyInterrupt(this.original.formData) |
| 2507 | } |
| 2508 | |
| 2509 | get text() { |
| 2510 | return this.applyInterrupt(this.original.text) |
nothing calls this directly
no outgoing calls
no test coverage detected