Skip to content

Commit 06df12f

Browse files
committed
chore: extend encoding test
1 parent e64797d commit 06df12f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cypress/integration/middleware/enhanced.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe('Enhanced middleware', () => {
22
it('rewrites the response body', () => {
33
cy.visit('/static')
4-
cy.get('#message').contains('This was static & old but has been transformed in')
4+
cy.get('#message').contains('This was static (& escaping test &) but has been transformed in')
55
cy.contains("This is an ad that isn't shown by default")
66
})
77

@@ -10,7 +10,7 @@ describe('Enhanced middleware', () => {
1010
expect(response.body).to.have.nested.property('pageProps.showAd', true)
1111
expect(response.body)
1212
.to.have.nested.property('pageProps.message')
13-
.that.includes('This was static & old but has been transformed in')
13+
.that.includes('This was static (& escaping test &) but has been transformed in')
1414
})
1515
})
1616

@@ -27,13 +27,13 @@ describe('Enhanced middleware', () => {
2727

2828
it('handles uppercase i18n redirects properly ', () => {
2929
cy.visit('/de-DE/static')
30-
cy.get('#message').contains('This was static & old but has been transformed in')
30+
cy.get('#message').contains('This was static (& escaping test &) but has been transformed in')
3131
cy.contains("This is an ad that isn't shown by default")
3232
})
3333

3434
it('handles lowercase i18n redirects properly ', () => {
3535
cy.visit('/de-de/static')
36-
cy.get('#message').contains('This was static & old but has been transformed in')
36+
cy.get('#message').contains('This was static (& escaping test &) but has been transformed in')
3737
cy.contains("This is an ad that isn't shown by default")
3838
})
3939
})

demos/middleware/middleware.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function middleware(req: NextRequest) {
2424
if (pathname.startsWith('/static')) {
2525
// Unlike NextResponse.next(), this actually sends the request to the origin
2626
const res = await request.next()
27-
const message = `This was static & old but has been transformed in ${req.geo?.city}`
27+
const message = `This was static (& escaping test &) but has been transformed in ${req.geo?.city}`
2828

2929
// Transform the response HTML and props
3030
res.replaceText('p[id=message]', message)

0 commit comments

Comments
 (0)