CodeChain-io / jsonrpc-filter

A proxy server that allows the only subsets of the RPCs
GNU Affero General Public License v3.0
4 stars 6 forks source link

Return spec compliant error objects #19

Open foriequal0 opened 4 years ago

foriequal0 commented 4 years ago

JSON-RPC specifies types of error objects. For example, when there isn't a method for the request, the spec requires to response with the following object:

{"jsonrpc":"2.0","error":{"code":-32601,"message":"Method not found"},"id":1}'

https://www.jsonrpc.org/specification#error_object

There are already some test cases that address it: https://github.com/CodeChain-io/jsonrpc-filter/blob/master/test/e2e_test.sh#L72

However, we just don't respond to a such request. That's why our current test is failing: https://github.com/CodeChain-io/jsonrpc-filter/commit/cbfb77c1daeeab5fd09399350261f18f53dbd172/checks?check_suite_id=321871236