filecoin-project / filecoin-project/go-jsonrpc
RPC call returns HTTP 500 in case of data error
- Dominant language
- Go
- Stars
- 100
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When the request body contains invalid data (method name for example), for some reason Filecoin node return HTTP 500 code together with JSON containing all info about the error, while many other protocols return HTTP 200 in this case (with similar error JSON).
Normally HTTP 500 means server-error, supposing the client will retry the same request later. So it doesn't look like a proper code for this case.
**To Reproduce**
Steps to reproduce:
1. Run
curl --location --request POST 'https://hyperspace.filfox.info/rpc/v0' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "Filecoin.WalletBalance",
"params": []
}
'
2. Check the HTTP status code in response
Fact result:
The HTTP code is 500
Expected behavior:
HTTP code should be 200
**Version (run lotus --version):**
Filecoin.NetVersion returns 19
Filecoin.EthProtocolVersion returns 0x13
sorry, don't have access to the client itself
**Artefacts**
The response body for the request from the example:
{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"wrong param count (method 'Filecoin.WalletBalance'): 0 != 1"}}
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.