Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return JSON response when request body is invalid JSON #14

Open
JakeUrban opened this issue Dec 18, 2023 · 1 comment
Open

Return JSON response when request body is invalid JSON #14

JakeUrban opened this issue Dec 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@JakeUrban
Copy link

JakeUrban commented Dec 18, 2023

What version are you using?

Not sure (from a partner)

What did you do?

Sent an RPC request with an invalid JSON body.

curl https://soroban-testnet.stellar.org:443 
  -H 'Content-Type: application/json' 
  -d '[{"jsonrpc": "2.0", "method": "getHealth", "id": "1234567890"},{"jsonrpc": "2.0", "method": "getTransaction", "id": "1234567891","params":{"6bc97bddc21811c626839baf4ab574f4f9f7ddbebb44d286ae504396d4e752da"}}]'

What did you expect to see?

A valid JSON response body.

What did you see instead?

Got back a non-JSON response body.

[-32700] invalid request value
@JakeUrban JakeUrban added the bug Something isn't working label Dec 18, 2023
@mollykarcher mollykarcher removed their assignment Dec 18, 2023
@2opremio
Copy link
Contributor

I am pretty sure this behavior comes from the upstream library we are using: https://github.com/creachadair/jrpc2 , but we should confirm.

Note, however, that the client should be anyhow prepared for non-JSON-encoded response bodies in case of errors (e.g. an intermediary proxy could be erroring and there are no guarantees on the format).

@stellarsaur stellarsaur transferred this issue from stellar/stellar-cli Feb 1, 2024
@mollykarcher mollykarcher moved this from Backlog to To Do in Platform Scrum Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To Do
Development

No branches or pull requests

4 participants
@mollykarcher @2opremio @JakeUrban and others