Skip to content

fix: add defensive programming to github api response handling - #408

Open
Karthik-vangapandu8 wants to merge 1 commit into
interviewstreet:mainfrom
Karthik-vangapandu8:fix-github-api-resiliency
Open

fix: add defensive programming to github api response handling#408
Karthik-vangapandu8 wants to merge 1 commit into
interviewstreet:mainfrom
Karthik-vangapandu8:fix-github-api-resiliency

Conversation

@Karthik-vangapandu8

Copy link
Copy Markdown

Description:
This PR improves the resilience of GitHub API response handling.
Previously, rate limit headers and API responses were directly parsed without validation. If GitHub returned unexpected header values or invalid JSON responses, the application could raise exceptions and fail.
This change adds defensive handling for:

  • Invalid GitHub rate limit header values
  • Invalid rate limit reset timestamps
  • Invalid JSON responses from the GitHub API
    Instead of crashing, the application now logs warnings/errors and continues gracefully.

Changes

  • Added safe parsing for X-RateLimit-Remaining and X-RateLimit-Limit
  • Added safe parsing for X-RateLimit-Reset
  • Added handling for invalid JSON responses from GitHub API

Testing

  • Verified existing GitHub API fetching flow continues working
  • Tested fallback behavior for invalid header values and malformed responses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant