-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Rewrite Headers support during routing (#3897)
- Loading branch information
1 parent
a996b40
commit c1ac2ee
Showing
11 changed files
with
128 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
crates/next-dev-tests/tests/integration/next/router/redirect/input/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** @type {import('next').NextConfig} */ | ||
module.exports = { | ||
async redirects() { | ||
return [ | ||
{ | ||
source: "/foo", | ||
destination: "https://example.vercel.sh/", | ||
permanent: true, | ||
}, | ||
]; | ||
}, | ||
}; |
17 changes: 17 additions & 0 deletions
17
crates/next-dev-tests/tests/integration/next/router/redirect/input/pages/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useEffect } from "react"; | ||
|
||
export default function Foo() { | ||
useEffect(() => { | ||
// Only run on client | ||
import("@turbo/pack-test-harness").then(runTests); | ||
}); | ||
|
||
return "index"; | ||
} | ||
|
||
function runTests() { | ||
it("it should display foo, not index", async () => { | ||
const res = await fetch("/foo"); | ||
expect(res.url).toBe("https://example.vercel.sh/"); | ||
}); | ||
} |
11 changes: 11 additions & 0 deletions
11
crates/next-dev-tests/tests/integration/next/router/rewrite/input/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** @type {import('next').NextConfig} */ | ||
module.exports = { | ||
async rewrites() { | ||
return [ | ||
{ | ||
source: "/", | ||
destination: "/foo", | ||
}, | ||
]; | ||
}, | ||
}; |
16 changes: 16 additions & 0 deletions
16
crates/next-dev-tests/tests/integration/next/router/rewrite/input/pages/foo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useEffect } from "react"; | ||
|
||
export default function Foo() { | ||
useEffect(() => { | ||
// Only run on client | ||
import("@turbo/pack-test-harness").then(runTests); | ||
}); | ||
|
||
return "foo"; | ||
} | ||
|
||
function runTests() { | ||
it("it should display foo, not index", () => { | ||
expect(document.getElementById("__next").textContent).toBe("foo"); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c1ac2ee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
turbo-site – ./docs
www.turbo.build
turbo.vercel.app
turbo.build
www.turborepo.org
www.turborepo.com
turbo.vercel.sh
turbopack.org
turborepo.org
www.turbopack.org
turbo-site.vercel.sh
turbo-site-git-main.vercel.sh