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-
72
72
import { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'
73
73
import * as Log from '../build/output/log'
74
74
import escapePathDelimiters from '../shared/lib/router/utils/escape-path-delimiters'
75
- import { getUtils , normalizeNextQueryParam } from './server-utils'
75
+ import { getUtils } from './server-utils'
76
76
import isError , { getProperError } from '../lib/is-error'
77
77
import {
78
78
addRequestMeta ,
@@ -111,6 +111,7 @@ import { sendResponse } from './send-response'
111
111
import { handleInternalServerErrorResponse } from './future/route-modules/helpers/response-handlers'
112
112
import {
113
113
fromNodeOutgoingHttpHeaders ,
114
+ normalizeNextQueryParam ,
114
115
toNodeOutgoingHttpHeaders ,
115
116
} from './web/utils'
116
117
import { 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(
55
55
}
56
56
}
57
57
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
-
76
58
export function interpolateDynamicPath (
77
59
pathname : string ,
78
60
params : ParsedUrlQuery ,
Original file line number Diff line number Diff line change 1
1
import type { RequestData , FetchEventResult } from './types'
2
2
import type { RequestInit } from './spec-extension/request'
3
3
import { PageSignatureError } from './error'
4
- import { fromNodeOutgoingHttpHeaders } from './utils'
4
+ import { fromNodeOutgoingHttpHeaders , normalizeNextQueryParam } from './utils'
5
5
import { NextFetchEvent } from './spec-extension/fetch-event'
6
6
import { NextRequest } from './spec-extension/request'
7
7
import { NextResponse } from './spec-extension/response'
@@ -18,7 +18,6 @@ import { getTracer } from '../lib/trace/tracer'
18
18
import type { TextMapGetter } from 'next/dist/compiled/@opentelemetry/api'
19
19
import { MiddlewareSpan } from '../lib/trace/constants'
20
20
import { getEdgePreviewProps } from './get-edge-preview-props'
21
- import { normalizeNextQueryParam } from '../server-utils'
22
21
23
22
export class NextRequestHint extends NextRequest {
24
23
sourcePage : string
Original file line number Diff line number Diff line change 1
1
import type { OutgoingHttpHeaders } from 'http'
2
+ import {
3
+ NEXT_INTERCEPTION_MARKER_PREFIX ,
4
+ NEXT_QUERY_PARAM_PREFIX ,
5
+ } from '../../lib/constants'
2
6
3
7
/**
4
8
* Converts a Node.js IncomingHttpHeaders object to a Headers object. Any
@@ -146,3 +150,21 @@ export function validateURL(url: string | URL): string {
146
150
)
147
151
}
148
152
}
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(
23
23
} , / a p p - d i r / )
24
24
} )
25
25
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
+
26
30
describe . each ( [
27
31
{
28
32
title : 'Serverless Functions' ,
You can’t perform that action at this time.
0 commit comments