fix: return the degraded deep-health report instead of throwing
The API answers GET /v1/health/deep with 503 and a full report when a dependency is down. handleResponse treated that as an error, so deepHealth() could never report a degraded status. The Go SDK already accepts 503 for this endpoint. Claude-Session: https://claude.ai/code/session_01Agoc9bRVE9KL7mmWtey9Vq
This commit is contained in:
1 parent
eb95173015
commit
909691328e
1 file changed
+4
@@ -285,9 +285,13 @@ export class ElydoraClient {
|
|||||||
return handleResponse<HealthResponse>(res);
|
return handleResponse<HealthResponse>(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 503 carries the degraded report, not an error. */
|
||||||
async deepHealth(): Promise<DeepHealthResponse> {
|
async deepHealth(): Promise<DeepHealthResponse> {
|
||||||
const url = `${this.baseUrl}/v1/health/deep`;
|
const url = `${this.baseUrl}/v1/health/deep`;
|
||||||
const res = await fetch(url, { method: 'GET', headers: { 'Accept': 'application/json' } });
|
const res = await fetch(url, { method: 'GET', headers: { 'Accept': 'application/json' } });
|
||||||
|
if (res.status === 503) {
|
||||||
|
return (await res.json()) as DeepHealthResponse;
|
||||||
|
}
|
||||||
return handleResponse<DeepHealthResponse>(res);
|
return handleResponse<DeepHealthResponse>(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user