Feat: implement HTTP 304 with SQLite Cache (#42)

This commit is contained in:
Sukka
2024-10-09 09:25:25 +08:00
committed by GitHub
parent abf924c977
commit 07d3fdf05b
9 changed files with 144 additions and 48 deletions

View File

@@ -89,7 +89,7 @@ function createFetchRetry($fetch: typeof fetch): FetchWithRetry {
}
throw new ResponseError(res);
} else {
if (!res.ok && retryOpts.retryOnNon2xx) {
if ((!res.ok && res.status !== 304) && retryOpts.retryOnNon2xx) {
throw new ResponseError(res);
}
return res;
@@ -106,7 +106,7 @@ function createFetchRetry($fetch: typeof fetch): FetchWithRetry {
return bail(err) as never;
}
console.log(picocolors.gray('[fetch fail]'), url);
console.log(picocolors.gray('[fetch fail]'), url, err);
throw err;
}
}, retryOpts);