Assert built asset security headers in smoke test
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
1 parent
9b3ffaa235
commit
1db2ef8e82
1 file changed
+6
@@ -211,6 +211,12 @@ async function main() {
|
||||
)}.`,
|
||||
);
|
||||
}
|
||||
if ((assetResponse.headers.get("x-content-type-options") ?? "").toLowerCase() !== "nosniff") {
|
||||
throw new Error("Smoke test failed: expected nosniff on built asset response.");
|
||||
}
|
||||
if ((assetResponse.headers.get("cross-origin-resource-policy") ?? "").toLowerCase() !== "same-origin") {
|
||||
throw new Error("Smoke test failed: expected CORP header on built asset response.");
|
||||
}
|
||||
const missingAssetUrl = new URL("/assets/missing-bundle.js", parsedAppUrl);
|
||||
const missingAsset = await fetch(missingAssetUrl);
|
||||
if (missingAsset.status !== 404) {
|
||||
|
||||
Reference in new issue
Block a user