Repository navigation
fix(client): return false from healthCheck on non-2xx responses - #258
Merged
Merged
Conversation
healthCheck() resolved true for any HTTP status because fetch resolves regardless of status. It now returns response.ok, so 502/503 from an ingress in front of a stopped gateway or a 404 from a misconfigured baseURL report unhealthy, matching the spec's 200-if-healthy contract. Add a regression test covering a 503 response.
Closed
3 tasks
inference-gateway-maintainer
Bot
marked this pull request as ready for review
September 25, 2026 22:51
inference-gateway-releaser Bot
added a commit
that referenced
this pull request
Sep 26, 2026
## [0.25.2](v0.25.1...v0.25.2) (2026-09-26) ### 🐛 Bug Fixes * **client:** return false from healthCheck on non-2xx responses ([#258](#258)) ([b2eefa7](b2eefa7)) ### 📚 Documentation * **readme:** document healthCheck false on non-2xx and network failures ([#260](#260)) ([2970b20](2970b20)) * **readme:** fix Tool Calls example typing and gateway intro link ([#259](#259)) ([e3d38f0](e3d38f0)) ### 🔧 Miscellaneous * **deps:** bump claude-code 2.1.278 -> 2.1.280 ([#254](#254)) ([a3c5aaa](a3c5aaa)) * **deps:** bump infer CLI v0.205.3 -> v0.208.0 ([#255](#255)) ([f2314da](f2314da))
Contributor
|
🎉 This PR is included in version 0.25.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #256
Summary
healthCheck()resolvedtruefor any HTTP status becausefetchresolves for every response, including non-2xx ones. It now returnsresponse.ok, so a502/503from an ingress or load balancer in front of a stopped gateway, or a404from a misconfiguredbaseURL, is reported as unhealthy. This matches the OpenAPI spec's contract forGET /health("Returns a 200 status code if the service is healthy") and the README usage. A rejectedfetch(network failure) still resolvesfalse.Changes
src/client.ts:healthCheck()now returnsresponse.okinstead of unconditionally returningtrueafter a resolved fetchtests/client.test.ts: add a regression test covering a503response using a realResponseobject, mirroring the issue's reproductionopenapi.yamlchanges; generated types are untouchedTests
npm test: 43 passed, including the new "should return false when API answers with an HTTP error status" casenpm run lintandnpm run format: cleanDocs