Skip to content

Commit 37de1f3

Browse files
committed
redirects for /changelog-next/
1 parent 4e41ee1 commit 37de1f3

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/index.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,28 @@ describe("Cloudflare Docs", () => {
6363
expect(response.headers.get("Location")).toBe("/products/");
6464
});
6565

66+
it("redirects /changelog/index.xml to /release-notes/index.xml", async () => {
67+
const request = new Request("http://fakehost/changelog/index.xml");
68+
const response = await SELF.fetch(request, { redirect: "manual" });
69+
expect(response.status).toBe(301);
70+
expect(response.headers.get("Location")).toBe("/release-notes/index.xml");
71+
});
72+
73+
it("redirects /changelog-next/ to /changelog/", async () => {
74+
const request = new Request("http://fakehost/changelog-next/");
75+
const response = await SELF.fetch(request, { redirect: "manual" });
76+
expect(response.status).toBe(301);
77+
expect(response.headers.get("Location")).toBe("/changelog/");
78+
});
79+
80+
it("redirects /changelog-next/rss.xml to /changelog/rss.xml", async () => {
81+
const request = new Request("http://fakehost/changelog-next/rss.xml");
82+
const response = await SELF.fetch(request, { redirect: "manual" });
83+
84+
expect(response.status).toBe(301);
85+
expect(response.headers.get("Location")).toBe("/changelog/rss.xml");
86+
});
87+
6688
it("responds with 404.html at `/non-existent`", async () => {
6789
const request = new Request("http://fakehost/non-existent");
6890
const response = await SELF.fetch(request);

wrangler-workers.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ rules = [
1616
directory = "./dist"
1717
binding = "ASSETS"
1818
not_found_handling = "404-page"
19+
run_worker_first = true
1920

2021
[[kv_namespaces]]
2122
binding = "API_DOCS_KV"

0 commit comments

Comments
 (0)