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

Function parseBackendUrl

scripts/proxy-utils.mjs:41–52  ·  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:
49 Number.parseInt(url.port, 10) || (url.protocol === "https:" ? 443 : 80),
50 protocol: url.protocol,
51 };
52}
53
54function writeInvalidBackendUrlResponse(req, res) {
55 const message = "Invalid backend URL";

Callers 1

proxyServerInfoRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected