(basePath: string, url: URL)
| 113 | } |
| 114 | |
| 115 | export function isValidUrlBasePath(basePath: string, url: URL) { |
| 116 | // normalize the paths to always end with a slash for the check |
| 117 | let pathname = url.pathname; |
| 118 | if (!pathname.endsWith('/')) { |
| 119 | pathname += '/'; |
| 120 | } |
| 121 | if (!basePath.endsWith('/')) { |
| 122 | basePath += '/'; |
| 123 | } |
| 124 | return pathname.startsWith(basePath); |
| 125 | } |
| 126 | |
| 127 | function normalizeHttpRequest(devServerConfig: d.DevServerConfig, incomingReq: IncomingMessage) { |
| 128 | const req: d.HttpRequest = { |