Assert 304 responses omit content-length in smoke

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 03:12:38 +00:00
1 parent adac335c3f
commit 4ed9832794
1 file changed
+15
+15
View File
@@ -273,6 +273,12 @@ async function main() {
if ((conditionalAsset.headers.get("cache-control") ?? "").toLowerCase() !== assetCacheControl) {
throw new Error("Smoke test failed: expected cache-control preserved on conditional asset response.");
}
const conditionalAssetContentLength = conditionalAsset.headers.get("content-length");
if (conditionalAssetContentLength !== null && conditionalAssetContentLength !== "0") {
throw new Error(
`Smoke test failed: expected no content-length (or 0) on conditional asset response, got ${conditionalAssetContentLength}.`,
);
}
const weakConditionalAsset = await fetch(assetUrl, {
headers: {
"If-None-Match": `W/${assetEtag}`,
@@ -306,6 +312,15 @@ async function main() {
"Smoke test failed: expected cache-control preserved on conditional HEAD asset response.",
);
}
const conditionalHeadAssetContentLength = conditionalHeadAsset.headers.get("content-length");
if (
conditionalHeadAssetContentLength !== null &&
conditionalHeadAssetContentLength !== "0"
) {
throw new Error(
`Smoke test failed: expected no content-length (or 0) on conditional HEAD asset response, got ${conditionalHeadAssetContentLength}.`,
);
}
const rangeEnd = Math.min(15, assetContentLength - 1);
const rangedAsset = await fetch(assetUrl, {
headers: {