MCPcopy Create free account
hub / github.com/ding113/claude-code-hub / sanitizedRequestPath

Function sanitizedRequestPath

server.js:110–125  ·  view source on GitHub ↗
(rawUrl)

Source from the content-addressed store, hash-verified

108}
109
110function sanitizedRequestPath(rawUrl) {
111 if (typeof rawUrl !== "string" || rawUrl.length === 0) {
112 return "/";
113 }
114 try {
115 const parsed = new URL(rawUrl, "http://localhost");
116 const masked = new URLSearchParams();
117 parsed.searchParams.forEach((value, key) => {
118 masked.append(key, ALLOWED_LOGGED_QUERY_KEYS.has(key.toLowerCase()) ? value : "***");
119 });
120 const qs = masked.toString();
121 return qs.length > 0 ? `${parsed.pathname}?${qs}` : parsed.pathname;
122 } catch {
123 return "/";
124 }
125}
126
127async function handleWebSocketConnection(ws, req) {
128 const url = new URL(req.url, `http://${req.headers.host || "localhost"}`);

Callers 2

mainFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected