Skip to content

Commit 3d6a5bb

Browse files
committed
useStaleWhileRevalidate must be false if the header is absent
1 parent 9f01d46 commit 3d6a5bb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ module.exports = class CachePolicy {
472472
}
473473

474474
useStaleWhileRevalidate() {
475-
return this.maxAge() + toNumberOrZero(this._rescc['stale-while-revalidate']) > this.age();
475+
const swr = toNumberOrZero(this._rescc['stale-while-revalidate']);
476+
return swr > 0 && this.maxAge() + swr > this.age();
476477
}
477478

478479
static fromObject(obj) {

0 commit comments

Comments
 (0)