Skip to content

fix: fix Invalid URL error when using uppercase i18n url #1812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Nov 29, 2022
12 changes: 12 additions & 0 deletions cypress/integration/middleware/enhanced.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,16 @@ describe('Enhanced middleware', () => {
expect(response.body).to.have.nested.property('headers.x-geo-timezone')
})
})

it('handles uppercase i18n redirects properly ', () => {
cy.visit('/de-DE/static')
cy.get('#message').contains('This was static but has been transformed in')
cy.contains("This is an ad that isn't shown by default")
})

it('handles lowercase i18n redirects properly ', () => {
cy.visit('/de-de/static')
cy.get('#message').contains('This was static but has been transformed in')
cy.contains("This is an ad that isn't shown by default")
})
})
2 changes: 1 addition & 1 deletion demos/middleware/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const nextConfig = {
generateBuildId: () => 'build-id',
i18n: {
defaultLocale: 'en',
locales: ['en'],
locales: ['en', 'de-DE'],
},
}

Expand Down
2 changes: 1 addition & 1 deletion jestSetup.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line n/no-unpublished-require
require('jest-fetch-mock').enableMocks()
Loading