( input: RequestInfo | URL, init?: RequestInit )
| 137 | const fetchHttpHandlerStorage = new AsyncLocalStorage<Array<HttpHandler>>(); |
| 138 | |
| 139 | const fetchWithInterceptors = async ( |
| 140 | input: RequestInfo | URL, |
| 141 | init?: RequestInit |
| 142 | ): Promise<Response> => { |
| 143 | const handlers = fetchHttpHandlerStorage.getStore(); |
| 144 | |
| 145 | if (handlers) { |
| 146 | try { |
| 147 | const { getResponse } = await import("msw"); |
| 148 | |
| 149 | const request = new Request(input, init); |
| 150 | |
| 151 | const response = await getResponse(handlers, request); |
| 152 | |
| 153 | if (response) { |
| 154 | return response; |
| 155 | } |
| 156 | } catch (e) { |
| 157 | // Do nothing |
| 158 | return fetch(input, init); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | return fetch(input, init); |
| 163 | }; |
| 164 | |
| 165 | class FetchErrorWithSpan extends Error { |
| 166 | constructor( |
no test coverage detected
searching dependent graphs…