( req: BaseNextRequest | IncomingMessage, paramKeys: string[] )
| 55 | } |
| 56 | |
| 57 | export 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 | |
| 75 | export function interpolateDynamicPath( |
| 76 | pathname: string, |
no test coverage detected