Skip to content

Commit

Permalink
Merge 79aca4e into c1ac2ee
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell authored Feb 22, 2023
2 parents c1ac2ee + 79aca4e commit 5b1ac12
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 5b1ac12

Please sign in to comment.