Skip to content

Commit

Permalink
Merge e52a66a into d48f1bc
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell authored Mar 2, 2023
2 parents d48f1bc + e52a66a commit dc56f0b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @type {import('next').NextConfig} */
module.exports = {
async headers() {
return [
{
source: "/foo",
headers: [
{
key: "x-foo",
value: "bar",
},
],
},
];
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Foo() {
return "check x-foo header";
}
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("should set header onto response", async () => {
const res = await fetch("/foo");
expect(res.headers.get("x-foo")).toBe("bar");
});
}

0 comments on commit dc56f0b

Please sign in to comment.