MCPcopy
hub / github.com/vercel/next.js / normalizeCdnUrl

Function normalizeCdnUrl

packages/next/src/server/server-utils.ts:57–73  ·  view source on GitHub ↗
(
  req: BaseNextRequest | IncomingMessage,
  paramKeys: string[]
)

Source from the content-addressed store, hash-verified

55}
56
57export function normalizeCdnUrl(
58 req: BaseNextRequest | IncomingMessage,
59 paramKeys: string[]
60) {
61 // make sure to normalize req.url from CDNs to strip dynamic and rewrite
62 // params from the query which are added during routing
63 const _parsedUrl = parseReqUrl(req.url!)
64
65 // we can't normalize if we can't parse
66 if (!_parsedUrl) {
67 return req.url
68 }
69 delete (_parsedUrl as any).search
70 filterInternalQuery(_parsedUrl.query, paramKeys)
71
72 req.url = formatUrl(_parsedUrl)
73}
74
75export function interpolateDynamicPath(
76 pathname: string,

Callers 1

getServerUtilsFunction · 0.85

Calls 3

parseReqUrlFunction · 0.90
formatUrlFunction · 0.90
filterInternalQueryFunction · 0.85

Tested by

no test coverage detected