docs: Add comment explaining why conditional headers are skipped when override is true

Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-08 13:37:23 +00:00
parent 23cdaa2350
commit ffb02a8866

View File

@ -182,6 +182,9 @@ export function defaultRequestInterceptor(axios: AxiosCacheInstance): RequestInt
config
);
// Skip adding conditional headers (If-None-Match, If-Modified-Since) when override is true.
// The override option is meant to bypass cache and get fresh data, not revalidate existing cache.
// Adding conditional headers would cause the server to return 304 Not Modified instead of fresh data.
if ((cache.state === 'stale' || cache.state === 'must-revalidate') && !overrideCache) {
updateStaleRequest(cache, config as ConfigWithCache<unknown>);