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

Function probeHealth

packages/computer/src/backends/test.ts:71–85  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

69}
70
71async function probeHealth(url: string): Promise<void> {
72 const healthUrl = `${stripTrailingSlash(toHttpUrl(url))}/health`;
73 let response: Response;
74 try {
75 response = await fetch(healthUrl);
76 } catch (cause) {
77 throw new Error(
78 `TestBackend: ${healthUrl} is not reachable. ` +
79 `Is the computerd container running? (${cause instanceof Error ? cause.message : String(cause)})`,
80 );
81 }
82 if (!response.ok) {
83 throw new Error(`TestBackend: ${healthUrl} returned ${response.status} ${response.statusText}`);
84 }
85}
86
87function toHttpUrl(input: string): string {
88 if (input.startsWith("ws://")) return `http://${input.slice("ws://".length)}`;

Callers 1

connectMethod · 0.85

Calls 3

stripTrailingSlashFunction · 0.85
toHttpUrlFunction · 0.70
fetchFunction · 0.50

Tested by

no test coverage detected