MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / checkConnection

Method checkConnection

sdk/src/client.ts:67–86  ·  view source on GitHub ↗

* Check connection to the Codebuff backend by hitting the /healthz endpoint. * * @returns Promise that resolves to true if connected, false otherwise

()

Source from the content-addressed store, hash-verified

65 * @returns Promise that resolves to true if connected, false otherwise
66 */
67 public async checkConnection(): Promise<boolean> {
68 try {
69 const response = await fetch(`${WEBSITE_URL}/api/healthz`, {
70 method: 'GET',
71 signal: AbortSignal.timeout(5000), // 5 second timeout
72 })
73
74 if (!response.ok) return false
75
76 const result = await response.json()
77 return (
78 typeof result === 'object' &&
79 result !== null &&
80 'status' in result &&
81 (result as { status?: unknown }).status === 'ok'
82 )
83 } catch {
84 return false
85 }
86 }
87}

Callers 3

checkConnectionFunction · 0.80
client.test.tsFile · 0.80

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected