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

Function parseBackendUrl

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

Source from the content-addressed store, hash-verified

71}
72
73function parseBackendUrl(backendUrl) {
74 const url = new URL(backendUrl);
75 if (url.protocol !== "http:" && url.protocol !== "https:") {
76 throw new Error("Invalid backend URL");
77 }
78 return {
79 hostname: url.hostname,
80 port:
81 Number.parseInt(url.port, 10) || (url.protocol === "https:" ? 443 : 80),
82 protocol: url.protocol,
83 };
84}
85
86function writeInvalidBackendUrlResponse(req, res) {
87 const message = "Invalid backend URL";

Callers 1

proxyServerInfoRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected