MCPcopy Create free account
hub / github.com/stenciljs/core / isValidUrlBasePath

Function isValidUrlBasePath

src/dev-server/request-handler.ts:115–125  ·  view source on GitHub ↗
(basePath: string, url: URL)

Source from the content-addressed store, hash-verified

113}
114
115export 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
127function normalizeHttpRequest(devServerConfig: d.DevServerConfig, incomingReq: IncomingMessage) {
128 const req: d.HttpRequest = {

Callers 1

defaultHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected