fix: add apiClient with status validation to prevent caching of error…gssoc#1496
fix: add apiClient with status validation to prevent caching of error…gssoc#1496vaishnavi003-svg wants to merge 3 commits into
Conversation
|
Thank you @, for creating the PR and contributing to our UltimateHealth project 💗. |
❌ PR Validation FailedThis PR was marked as To resolve this, please ensure your PR description links an issue (e.g., |
I will kill you if you do not fix by tomorrow. |
|
@SB2318 |
|
/review |
🤖 Gemini AI Code ReviewSummaryThis Pull Request aims to address issue #1197 by introducing a new While the intent is excellent and the core idea of validating status codes is sound, the implementation introduces several critical issues, including syntax errors, runtime errors, and significant architectural changes unrelated to the stated purpose. The PR also contains inconsistencies in error handling and potentially breaks existing functionality due to unrelated changes. 🔴 High Severity
🟡 Medium Severity
🟢 Low Severity / Nits
What's Good ✅
VerdictRequest Changes The PR introduces several High Severity issues, including syntax errors, runtime errors due to missing imports, and significant, unrelated architectural changes ( |
|
@vaishnavi003-svg, please cover the bot points |
SB2318
left a comment
There was a problem hiding this comment.
@vaishnavi003-svg please fix the bot points.
|
@SB2318 Working on the bot review points, will push fixes shortly. |
|
@SB2318 ✅ PROD_URL - single declaration with Constants import Ready for final review! |
PR Description
Added a new apiClient.ts file that validates HTTP status codes before returning responses. Only successful (2xx) responses are now cached. Error responses (4xx, 5xx) throw errors and are not cached, preventing stale error data from being served to users.
Type of Change
Select your work-area
Related Issue
#1197
Add your Work Example
📷 No UI changes - This is a backend logic fix. The fix ensures that when an API returns a 5xx error, that error response is NOT cached. Subsequent requests will hit the actual API instead of receiving a stale error.
Fixes (mention the issue number which this fixes)
Fixes #1197
Checklist
Undertaking
My code follows the style guidelines of this project.
I have performed a self-review of my code.
I have commented my code, particularly in hard-to-understand areas.
I have made corresponding changes to the documentation.
I have checked for plagiarism and assure its authenticity.
I have read and followed the code of conduct for this repository. I understand that violation of this undertaking may have legal consequences.
I Agree