()
| 19320 | } |
| 19321 | |
| 19322 | return `${url.pathname}${url.search}${url.hash}`; |
| 19323 | } catch (error) { |
| 19324 | if (!likelyApiPath) { |
| 19325 | return endpoint; |
| 19326 | } |
| 19327 | |
| 19328 | console.warn('Unable to normalize endpoint for network context', endpoint, error); |
| 19329 | const hasQuery = trimmed.includes('?'); |
| 19330 | const alreadyHasParam = trimmed.includes(`${NETWORK_CONTEXT_PARAM}=`); |
| 19331 | |
| 19332 | if (alreadyHasParam) { |
| 19333 | return endpoint; |
| 19334 | } |
| 19335 | |
| 19336 | const separator = hasQuery ? '&' : '?'; |
| 19337 | return `${trimmed}${separator}${NETWORK_CONTEXT_PARAM}=${encodeURIComponent(network)}`; |
| 19338 | } |
| 19339 | } |
| 19340 | |
| 19341 | function networkAwareFetch(endpoint, options = {}) { |
| 19342 | const resolvedEndpoint = resolveNetworkAwareEndpoint(endpoint); |
| 19343 | return fetch(resolvedEndpoint, options); |
| 19344 | } |
nothing calls this directly
no test coverage detected