Assert HEAD stale If-Unmodified-Since failures
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
1 parent
0aebf5b590
commit
ae24ea691c
1 file changed
+16
@@ -579,6 +579,22 @@ async function main() {
|
||||
if (ifMatchMismatchHeadAsset.headers.get("last-modified") !== assetLastModified) {
|
||||
throw new Error("Smoke test failed: expected Last-Modified on HEAD If-Match mismatch response.");
|
||||
}
|
||||
const ifUnmodifiedSinceStaleHeadAsset = await fetch(assetUrl, {
|
||||
method: "HEAD",
|
||||
headers: {
|
||||
"If-Unmodified-Since": staleUnmodifiedSince,
|
||||
},
|
||||
});
|
||||
if (ifUnmodifiedSinceStaleHeadAsset.status !== 412) {
|
||||
throw new Error(
|
||||
`Smoke test failed: expected HEAD stale If-Unmodified-Since status 412, received ${ifUnmodifiedSinceStaleHeadAsset.status}.`,
|
||||
);
|
||||
}
|
||||
if ((ifUnmodifiedSinceStaleHeadAsset.headers.get("cache-control") ?? "").toLowerCase() !== "no-store") {
|
||||
throw new Error(
|
||||
"Smoke test failed: expected cache-control=no-store on HEAD stale If-Unmodified-Since response.",
|
||||
);
|
||||
}
|
||||
const ifMatchRangeMismatchHeadAsset = await fetch(assetUrl, {
|
||||
method: "HEAD",
|
||||
headers: {
|
||||
|
||||
Reference in new issue
Block a user