MCPcopy Create free account
hub / github.com/cloudflare/computer / httpGet

Function httpGet

script/computerd-stub-soak.mjs:149–162  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

147}
148
149function httpGet(url) {
150 return new Promise((res, rej) => {
151 const req = request(url, (r) => {
152 let body = "";
153 r.setEncoding("utf8");
154 r.on("data", (c) => {
155 body += c;
156 });
157 r.on("end", () => res({ statusCode: r.statusCode ?? 0, body }));
158 });
159 req.once("error", rej);
160 req.end();
161 });
162}
163
164async function waitForHealth(port, child, deadlineMs = 5000) {
165 const started = Date.now();

Callers 2

waitForHealthFunction · 0.85
targetSnapshotFunction · 0.85

Calls 2

requestFunction · 0.85
endMethod · 0.65

Tested by

no test coverage detected