MCPcopy Index your code
hub / github.com/coder/code-server / ensureAddress

Function ensureAddress

src/node/app.ts:107–121  ·  view source on GitHub ↗
(server: http.Server, protocol: string)

Source from the content-addressed store, hash-verified

105 * The address might be a URL or it might be a pipe or socket path.
106 */
107export const ensureAddress = (server: http.Server, protocol: string): URL | string => {
108 const addr = server.address()
109
110 if (!addr) {
111 throw new Error("Server has no address")
112 }
113
114 if (typeof addr !== "string") {
115 const host = addr.family === "IPv6" ? `[${addr.address}]` : addr.address
116 return new URL(`${protocol}://${host}:${addr.port}`)
117 }
118
119 // If this is a string then it is a pipe or Unix socket.
120 return addr
121}
122
123/**
124 * Handles the error that occurs in the catch block

Callers 5

fetchMethod · 0.90
wsMethod · 0.90
update.test.tsFile · 0.90
app.test.tsFile · 0.90
runCodeServerFunction · 0.90

Calls 1

addressMethod · 0.45

Tested by

no test coverage detected