MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / parseBackendUrl

Function parseBackendUrl

scripts/proxy-utils.mjs:41–51  ·  view source on GitHub ↗
(backendUrl)

Source from the content-addressed store, hash-verified

39}
40
41function parseBackendUrl(backendUrl) {
42 const url = new URL(backendUrl);
43 if (url.protocol !== "http:" && url.protocol !== "https:") {
44 throw new Error("Invalid backend URL");
45 }
46 return {
47 hostname: url.hostname,
48 port: Number.parseInt(url.port, 10) || (url.protocol === "https:" ? 443 : 80),
49 protocol: url.protocol,
50 };
51}
52
53function writeInvalidBackendUrlResponse(req, res) {
54 const message = "Invalid backend URL";

Callers 1

proxyServerInfoRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected