Skip to content

Commit a4c5abd

Browse files
committed
fix: added new cookie testing page for missing matcher
1 parent fb2af2f commit a4c5abd

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

demos/middleware/middleware.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ export async function middleware(req: NextRequest) {
5656
if (pathname.startsWith('/cookies')) {
5757
response = NextResponse.next()
5858
response.cookies.set('netlifyCookie', 'true')
59+
return response
60+
}
61+
62+
if(pathname.startsWith('/matcher-cookie')) {
63+
response = NextResponse.next()
5964
response.cookies.set('missingCookie', 'true')
6065
return response
6166
}
@@ -126,6 +131,7 @@ export const config = {
126131
'/headers',
127132
{ source: '/static' },
128133
{ source: '/cookies' },
134+
{ source: '/matcher-cookie'},
129135
{ source: '/shows/((?!99|88).*)' },
130136
{
131137
source: '/conditional',
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const MatcherCookie = () => {
2+
return (
3+
<div>
4+
<p>The cookie "missingCookie" should be set to true</p>
5+
</div>
6+
)
7+
}
8+
9+
export default MatcherCookie

demos/middleware/pages/missing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const Missing = () => {
55
return (
66
<div>
77
<p>Will Check if 'missingCookie' is missing and display headers</p>
8-
<p>To test go to <Link href="/cookies">cookies page</Link> and come back</p>
8+
<p>To test go to <Link href="/matcher-cookie">cookies page</Link> and come back</p>
99
</div>
1010
)
1111
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Run Next.js seamlessly on Netlify",
55
"scripts": {
66
"build:demo": "cd demos/default && npm run build",
7-
"cy:open": "cypress open --config-file cypress/config/canary.json",
7+
"cy:open": "cypress open --config-file cypress/config/all.json",
88
"dev:demo": "next dev demos/default",
99
"format": "run-s format:check-fix:*",
1010
"format:ci": "run-s format:check:*",

0 commit comments

Comments
 (0)