make cache get used even if you make a bunch of identical requests immediately

This commit is contained in:
Randall Schmidt
2021-07-05 22:00:12 -04:00
parent 6cd42272c4
commit dae57d2604
5 changed files with 48 additions and 16 deletions

View File

@ -33,6 +33,10 @@ export class NFCResponse extends Response {
}
static fromCachedResponse(bodyStream, rawMetaData, ejectSelfFromCache) {
if (bodyStream.readableEnded) {
throw new Error('Cache returned a body stream that has already been read to end.');
}
return new NFCResponse(bodyStream, rawMetaData, ejectSelfFromCache, true);
}