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

Function startHttpServer

__tests__/scripts/static-server.test.ts:49–63  ·  view source on GitHub ↗
(server: Server)

Source from the content-addressed store, hash-verified

47 }
48
49 async function startHttpServer(server: Server) {
50 await new Promise<void>((resolve, reject) => {
51 server.once("error", reject);
52 server.listen(0, "127.0.0.1", () => {
53 server.off("error", reject);
54 resolve();
55 });
56 });
57 servers.push(server);
58 const address = server.address();
59 if (!address || typeof address === "string") {
60 throw new Error("Server did not bind to a TCP port");
61 }
62 return `http://127.0.0.1:${address.port}`;
63 }
64
65 async function getJson(url: string) {
66 return new Promise<{ status: number; body: unknown }>((resolve, reject) => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected