Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump connect-history-api-fallback from 1.6.0 to 2.0.0 (#2716) #4501

Merged
Merged
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"chokidar": "^3.5.3",
"colorette": "^2.0.10",
"compression": "^1.7.4",
"connect-history-api-fallback": "^1.6.0",
"connect-history-api-fallback": "^2.0.0",
"default-gateway": "^6.0.3",
"express": "^4.17.3",
"graceful-fs": "^4.2.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ exports[`historyApiFallback option as object with the "verbose" option request t
"
`;

exports[`historyApiFallback option in-memory files should perform HEAD request in same way as GET: response headers content-type 1`] = `"text/html; charset=utf-8"`;

exports[`historyApiFallback option in-memory files should perform HEAD request in same way as GET: response status 1`] = `"OK"`;

exports[`historyApiFallback option in-memory files should perform HEAD request in same way as GET: response text 1`] = `
"In-memory file
"
`;

exports[`historyApiFallback option in-memory files should take precedence over static files: console messages 1`] = `Array []`;

exports[`historyApiFallback option in-memory files should take precedence over static files: page errors 1`] = `Array []`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ exports[`historyApiFallback option as object with the "verbose" option request t
"
`;

exports[`historyApiFallback option in-memory files should perform HEAD request in same way as GET: response headers content-type 1`] = `"text/html; charset=utf-8"`;

exports[`historyApiFallback option in-memory files should perform HEAD request in same way as GET: response status 1`] = `"OK"`;

exports[`historyApiFallback option in-memory files should perform HEAD request in same way as GET: response text 1`] = `
"In-memory file
"
`;

exports[`historyApiFallback option in-memory files should take precedence over static files: console messages 1`] = `Array []`;

exports[`historyApiFallback option in-memory files should take precedence over static files: page errors 1`] = `Array []`;
Expand Down
40 changes: 40 additions & 0 deletions test/e2e/history-api-fallback.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,5 +643,45 @@ describe("historyApiFallback option", () => {

expect(pageErrors).toMatchSnapshot("page errors");
});

it("should perform HEAD request in same way as GET", async () => {
await page.goto(`http://127.0.0.1:${port}/foo`, {
waitUntil: "networkidle0",
});

const responseGet = await page.evaluate(async () => {
const response = await fetch("/foo", { method: "GET" });

return {
contentType: response.headers.get("content-type"),
statusText: response.statusText,
text: await response.text(),
};
});

expect(responseGet.contentType).toMatchSnapshot(
"response headers content-type"
);

expect(responseGet.statusText).toMatchSnapshot("response status");

expect(responseGet.text).toMatchSnapshot("response text");

const responseHead = await page.evaluate(async () => {
const response = await fetch("/foo", { method: "HEAD" });

return {
contentType: response.headers.get("content-type"),
statusText: response.statusText,
text: await response.text(),
};
});

expect(responseHead).toMatchObject({
...responseGet,
// HEAD response has an empty body
text: "",
});
});
});
});