Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Fix cypress:local: Skip test for cache control header #118

Merged
merged 1 commit into from
Dec 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cypress/integration/optionalCatchAll_at_root_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ describe("pre-rendered pages: /subfolder/[id].js", () => {
});

it("serves the pre-rendered HTML (and not the Netlify Function)", () => {
cy.request("/subfolder/static").then((response) => {
expect(response.headers["cache-control"]).to.include("public");
});
if (Cypress.env("DEPLOY") !== "local") {
cy.request("/subfolder/static").then((response) => {
expect(response.headers["cache-control"]).to.include("public");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowercase cache-control? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be uppercase? 😅 We have it lowercase in default_spec.js, too, and it seems to be working:

expect(response.headers["cache-control"]).to.include("private");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, headers are supposed to be case-insensitive: cypress-io/cypress#2879 (comment)

Cypress transforms all headers to lowercase, so that devs don't have to worry about it: cypress-io/cypress#2879 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dope!! merge away!!!!!!

});
}
});
});

Expand Down