Skip to content
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

Remove previous query param deleting warning #37740

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions packages/next/server/next-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1369,12 +1369,6 @@ export default class NextNodeServer extends BaseServer {
const parsedDestination = parseUrl(rewritePath)
const newUrl = parsedDestination.pathname

// TODO: remove after next minor version current `v12.0.9`
this.warnIfQueryParametersWereDeleted(
parsedUrl.query,
parsedDestination.query
)

if (
parsedDestination.protocol &&
(parsedDestination.port
Expand Down Expand Up @@ -1440,26 +1434,6 @@ export default class NextNodeServer extends BaseServer {
return require(join(this.distDir, ROUTES_MANIFEST))
}

// TODO: remove after next minor version current `v12.0.9`
private warnIfQueryParametersWereDeleted(
incoming: ParsedUrlQuery,
rewritten: ParsedUrlQuery
): void {
const incomingQuery = urlQueryToSearchParams(incoming)
const rewrittenQuery = urlQueryToSearchParams(rewritten)

const missingKeys = [...incomingQuery.keys()].filter((key) => {
return !rewrittenQuery.has(key)
})

if (missingKeys.length > 0) {
Log.warn(
`Query params are no longer automatically merged for rewrites in middleware, see more info here: https://nextjs.org/docs/messages/deleting-query-params-in-middlewares`
)
this.warnIfQueryParametersWereDeleted = () => {}
}
}

private async runEdgeFunctionApiEndpoint(params: {
req: NodeNextRequest
res: NodeNextResponse
Expand Down
13 changes: 0 additions & 13 deletions test/e2e/middleware-rewrites/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,6 @@ describe('Middleware Rewrite', () => {
}, 'success')
})

if (!(global as any).isNextDeploy) {
// runtime logs aren't currently available for deploy test
it(`warns about a query param deleted`, async () => {
await fetchViaHTTP(next.url, `/clear-query-params`, {
a: '1',
allowed: 'kept',
})
expect(next.cliOutput).toContain(
'Query params are no longer automatically merged for rewrites in middleware'
)
})
}

it('should allow to opt-out prefetch caching', async () => {
const browser = await webdriver(next.url, '/')
await browser.addCookie({ name: 'about-bypass', value: '1' })
Expand Down