Skip to content

Commit e9d0fda

Browse files
committed
Report stale-if-error as matching
1 parent 3463bfc commit e9d0fda

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,13 +596,15 @@ module.exports = class CachePolicy {
596596
*/
597597
revalidatedPolicy(request, response) {
598598
this._assertRequestHasHeaders(request);
599-
if(this._useStaleIfError() && isErrorResponse(response)) { // I consider the revalidation request unsuccessful
599+
600+
if (this._useStaleIfError() && isErrorResponse(response)) {
600601
return {
601-
modified: false,
602-
matches: false,
603-
policy: this,
602+
policy: this,
603+
modified: false,
604+
matches: true,
604605
};
605606
}
607+
606608
if (!response || !response.headers) {
607609
throw Error('Response headers missing');
608610
}

0 commit comments

Comments
 (0)