Skip to content

fix(api): validate HTTP status code in Solana RPC GetTotalSupply - #4279

Open
Tyagiquamar wants to merge 2 commits into
malbeclabs:mainfrom
Tyagiquamar:fix/api-solana-rpc-http-status-check
Open

Tyagiquamar wants to merge 2 commits into
malbeclabs:mainfrom
Tyagiquamar:fix/api-solana-rpc-http-status-check

Conversation

@Tyagiquamar

Copy link
Copy Markdown

In \�pi/internal/rpc.go, \GetTotalSupply\ previously passed non-200 HTTP responses (e.g., HTTP 429 rate limit or 503 gateway error) directly to \json.NewDecoder(resp.Body).Decode(&rpcResp). This resulted in obscure JSON decoding error messages ('EOF' or 'invalid character') rather than identifying the upstream RPC HTTP status failure.

This fix:

  1. Validates that
    esp.StatusCode == http.StatusOK\ before attempting JSON deserialization and returns a clear status error otherwise.
  2. Adds unit test coverage (\TestSolanaClient_GetTotalSupply_HTTPError) in \�pi/internal/server_test.go.

@Tyagiquamar
Tyagiquamar requested a review from a team September 4, 2026 18:38

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 62cb868. Configure here.

Comment thread api/internal/server_test.go Outdated
@Tyagiquamar

Copy link
Copy Markdown
Author

Hi, friendly ping for review on this PR when you have a moment. Happy to address any feedback. Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant