threefoldtech / web3gw

Proxy for the web3 world
Apache License 2.0
1 stars 1 forks source link

Invalid response returned if a method only has an error return and the error is nil #160

Closed LeeSmet closed 1 year ago

LeeSmet commented 1 year ago

In case of methods such as tfchain.Load, the function only returns an error. If the function succeed, said error will be nil. The json response returned by the server is then simply {'jsonrpc': '2.0', 'id': 1}, with the id field having the value sent by the client in the original request.

According to the jsonrpc2.0 specification section 5:

result This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method. The value of this member is determined by the method invoked on the Server.

Conforming clients will thus return an error since the server is technically misbehaving.