File tree Expand file tree Collapse file tree 5 files changed +29
-21
lines changed
test/e2e/app-dir/app-middleware Expand file tree Collapse file tree 5 files changed +29
-21
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ import { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-
7272import { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'
7373import * as Log from '../build/output/log'
7474import escapePathDelimiters from '../shared/lib/router/utils/escape-path-delimiters'
75- import { getUtils , normalizeNextQueryParam } from './server-utils'
75+ import { getUtils } from './server-utils'
7676import isError , { getProperError } from '../lib/is-error'
7777import {
7878 addRequestMeta ,
@@ -111,6 +111,7 @@ import { sendResponse } from './send-response'
111111import { handleInternalServerErrorResponse } from './future/route-modules/helpers/response-handlers'
112112import {
113113 fromNodeOutgoingHttpHeaders ,
114+ normalizeNextQueryParam ,
114115 toNodeOutgoingHttpHeaders ,
115116} from './web/utils'
116117import { CACHE_ONE_YEAR , NEXT_CACHE_TAGS_HEADER } from '../lib/constants'
Original file line number Diff line number Diff line change @@ -55,24 +55,6 @@ export function normalizeVercelUrl(
5555 }
5656}
5757
58- /**
59- * Normalizes `nxtP` and `nxtI` query param values to remove the prefix.
60- * This function does not mutate the input key; it calls the provided function
61- * with the normalized key.
62- */
63- export function normalizeNextQueryParam (
64- key : string ,
65- onKeyNormalized : ( normalizedKey : string ) => void
66- ) {
67- const prefixes = [ NEXT_QUERY_PARAM_PREFIX , NEXT_INTERCEPTION_MARKER_PREFIX ]
68- for ( const prefix of prefixes ) {
69- if ( key !== prefix && key . startsWith ( prefix ) ) {
70- const normalizedKey = key . substring ( prefix . length )
71- onKeyNormalized ( normalizedKey )
72- }
73- }
74- }
75-
7658export function interpolateDynamicPath (
7759 pathname : string ,
7860 params : ParsedUrlQuery ,
Original file line number Diff line number Diff line change 11import type { RequestData , FetchEventResult } from './types'
22import type { RequestInit } from './spec-extension/request'
33import { PageSignatureError } from './error'
4- import { fromNodeOutgoingHttpHeaders } from './utils'
4+ import { fromNodeOutgoingHttpHeaders , normalizeNextQueryParam } from './utils'
55import { NextFetchEvent } from './spec-extension/fetch-event'
66import { NextRequest } from './spec-extension/request'
77import { NextResponse } from './spec-extension/response'
@@ -18,7 +18,6 @@ import { getTracer } from '../lib/trace/tracer'
1818import type { TextMapGetter } from 'next/dist/compiled/@opentelemetry/api'
1919import { MiddlewareSpan } from '../lib/trace/constants'
2020import { getEdgePreviewProps } from './get-edge-preview-props'
21- import { normalizeNextQueryParam } from '../server-utils'
2221
2322export class NextRequestHint extends NextRequest {
2423 sourcePage : string
Original file line number Diff line number Diff line change 11import type { OutgoingHttpHeaders } from 'http'
2+ import {
3+ NEXT_INTERCEPTION_MARKER_PREFIX ,
4+ NEXT_QUERY_PARAM_PREFIX ,
5+ } from '../../lib/constants'
26
37/**
48 * Converts a Node.js IncomingHttpHeaders object to a Headers object. Any
@@ -146,3 +150,21 @@ export function validateURL(url: string | URL): string {
146150 )
147151 }
148152}
153+
154+ /**
155+ * Normalizes `nxtP` and `nxtI` query param values to remove the prefix.
156+ * This function does not mutate the input key; it calls the provided function
157+ * with the normalized key.
158+ */
159+ export function normalizeNextQueryParam (
160+ key : string ,
161+ onKeyNormalized : ( normalizedKey : string ) => void
162+ ) {
163+ const prefixes = [ NEXT_QUERY_PARAM_PREFIX , NEXT_INTERCEPTION_MARKER_PREFIX ]
164+ for ( const prefix of prefixes ) {
165+ if ( key !== prefix && key . startsWith ( prefix ) ) {
166+ const normalizedKey = key . substring ( prefix . length )
167+ onKeyNormalized ( normalizedKey )
168+ }
169+ }
170+ }
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ createNextDescribe(
2323 } , / a p p - d i r / )
2424 } )
2525
26+ it ( 'should not include any warnings about using Node.js APIs' , async ( ) => {
27+ expect ( next . cliOutput ) . not . toContain ( 'A Node.js module is loaded' )
28+ } )
29+
2630 describe . each ( [
2731 {
2832 title : 'Serverless Functions' ,
You can’t perform that action at this time.
0 commit comments