@@ -389,7 +389,7 @@ async function cacheFetch(url, options) {
389
389
}
390
390
}
391
391
392
- async function readFromCache ( ) {
392
+ async function readFromCache ( hit = false ) {
393
393
let data = await fs . promises . readFile ( cacheHeadersFilename , 'utf8' ) ;
394
394
let headers = JSON . parse ( data ) ;
395
395
let status = headers . status || 200 ;
@@ -409,9 +409,11 @@ async function cacheFetch(url, options) {
409
409
return new Response ( null , { url, status : 304 , headers } ) ;
410
410
}
411
411
let readable = fs . createReadStream ( cacheFilename ) ;
412
- // Indicate this is coming from the cache via
413
- // https://www.rfc-editor.org/rfc/rfc9211.html
414
- headers [ "cache-status" ] = "fetch-filecache-for-crawling; hit" ;
412
+ if ( hit ) {
413
+ // Indicate this is coming from the cache via
414
+ // https://www.rfc-editor.org/rfc/rfc9211.html
415
+ headers [ "cache-status" ] = "fetch-filecache-for-crawling; hit" ;
416
+ }
415
417
return new Response ( readable , { url, status, headers } ) ;
416
418
}
417
419
@@ -532,7 +534,7 @@ async function cacheFetch(url, options) {
532
534
}
533
535
else {
534
536
resolvePendingFetch ( ) ;
535
- return readFromCache ( ) ;
537
+ return readFromCache ( true ) ;
536
538
}
537
539
}
538
540
catch ( err ) {
0 commit comments