handle malformed json requests more gracefully
Open
Nobody has claimed this yet.
area: jsonrpc
priority: low
type: bug
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 493
- PR merge metrics
- No merged PRs in 30d
Description
Thanks to @sayplastic for spotting and suggesting we do this. An invalid request like below, we could provide a better error message.
curl -d '{"method": "account_balance", "params": {"wallet_id": "lbrytv-id.1596870.wallet"}' http://localhost:5579/
results in:
500 Internal Server Error
Server got itself in trouble
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the malformed request with the curl example against the HTTP server and trace how the invalid JSON is handled. Update the request error path so malformed JSON produces a useful client-facing error rather than a 500 response, then verify the behavior with the same request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100