(request: HttpRequest<any>)
| 82 | private readonly maxResponseSize = inject(HTTP_FETCH_MAX_RESPONSE_SIZE); |
| 83 | |
| 84 | handle(request: HttpRequest<any>): Observable<HttpEvent<any>> { |
| 85 | return new Observable((observer) => { |
| 86 | const aborter = new AbortController(); |
| 87 | |
| 88 | this.doRequest(request, aborter.signal, observer).then(noop, (error) => |
| 89 | observer.error(new HttpErrorResponse({error})), |
| 90 | ); |
| 91 | |
| 92 | let timeoutId: ReturnType<typeof setTimeout> | undefined; |
| 93 | if (request.timeout) { |
| 94 | // TODO: Replace with AbortSignal.any([aborter.signal, AbortSignal.timeout(request.timeout)]) |
| 95 | // when AbortSignal.any support is Baseline widely available (NET nov. 2026) |
| 96 | timeoutId = this.ngZone.runOutsideAngular(() => |
| 97 | setTimeout(() => { |
| 98 | if (!aborter.signal.aborted) { |
| 99 | aborter.abort(new DOMException('signal timed out', 'TimeoutError')); |
| 100 | } |
| 101 | }, request.timeout), |
| 102 | ); |
| 103 | } |
| 104 | |
| 105 | return () => { |
| 106 | if (timeoutId !== undefined) { |
| 107 | clearTimeout(timeoutId); |
| 108 | } |
| 109 | aborter.abort(); |
| 110 | }; |
| 111 | }); |
| 112 | } |
| 113 | |
| 114 | private async doRequest( |
| 115 | request: HttpRequest<any>, |
nothing calls this directly
no test coverage detected