( url: RequestInfo, options: RequestInit, method: string, format: 'json' | 'text', repeatIndex?: number, )
| 513 | } |
| 514 | |
| 515 | function getFetchCacheKey( |
| 516 | url: RequestInfo, |
| 517 | options: RequestInit, |
| 518 | method: string, |
| 519 | format: 'json' | 'text', |
| 520 | repeatIndex?: number, |
| 521 | ) { |
| 522 | const bodyForCacheKey = getBodyForFetchCacheKey( |
| 523 | options.body ?? (url instanceof Request ? url.body : undefined), |
| 524 | ); |
| 525 | if (!bodyForCacheKey.cacheable) { |
| 526 | return null; |
| 527 | } |
| 528 | |
| 529 | const optionsForCacheKey = getOptionsForFetchCacheKey(options, bodyForCacheKey.identity); |
| 530 | if (!optionsForCacheKey.cacheable) { |
| 531 | return null; |
| 532 | } |
| 533 | |
| 534 | const repeatSuffix = shouldApplyRepeatCacheSuffix(repeatIndex) ? `:repeat${repeatIndex}` : ''; |
| 535 | return getScopedCacheKey( |
| 536 | `fetch:v3:${hashFetchCacheKey({ |
| 537 | format, |
| 538 | headers: getHeadersForCacheKey(url, options), |
| 539 | method, |
| 540 | options: optionsForCacheKey.identity, |
| 541 | url: getUrlForFetchCacheKey(url), |
| 542 | })}${repeatSuffix}`, |
| 543 | ); |
| 544 | } |
| 545 | |
| 546 | function getAbortSignalId(signal: AbortSignal) { |
| 547 | let signalId = abortSignalIds.get(signal); |
no test coverage detected
searching dependent graphs…