| 39 | } |
| 40 | |
| 41 | async handle( |
| 42 | request: Request, |
| 43 | ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>> |
| 44 | ): Promise<FetchHandleResult> { |
| 45 | return intercept( |
| 46 | this.adapterInterceptors, |
| 47 | { |
| 48 | ...resolveFriendlyStandardHandleOptions(resolveMaybeOptionalOptions(rest)), |
| 49 | request, |
| 50 | toFetchResponseOptions: this.toFetchResponseOptions, |
| 51 | }, |
| 52 | async ({ request, toFetchResponseOptions, ...options }) => { |
| 53 | const standardRequest = toStandardLazyRequest(request) |
| 54 | |
| 55 | const result = await this.standardHandler.handle(standardRequest, options) |
| 56 | |
| 57 | if (!result.matched) { |
| 58 | return result |
| 59 | } |
| 60 | |
| 61 | return { |
| 62 | matched: true, |
| 63 | response: toFetchResponse(result.response, toFetchResponseOptions), |
| 64 | } |
| 65 | }, |
| 66 | ) |
| 67 | } |
| 68 | } |