mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-25 02:31:46 +00:00
rpc/lib/server: add handlers tests
Follow up of PR https://github.com/tendermint/tendermint/pull/724 For https://github.com/tendermint/tendermint/issues/708 Reported initially in #708, this bug was reconfirmed by the fuzzer. This fix ensures that: * if the user doesn't pass in `"id"` that we send them back a message in an error telling them to send `"id"`. Previously we let the handler return a 200 with nothing. * passing in nil `params` doesn't crash * not passing in `params` doesn't crash * passing in non-JSON parseable data to `params` doesn't crash
This commit is contained in:
@ -118,6 +118,8 @@ func makeJSONRPCHandler(funcMap map[string]*RPCFunc, logger log.Logger) http.Han
|
||||
// The Server MUST NOT reply to a Notification, including those that are within a batch request.
|
||||
if request.ID == "" {
|
||||
logger.Debug("HTTPJSONRPC received a notification, skipping... (please send a non-empty ID if you want to call a method)")
|
||||
// Not sending back a response here because according the JSONRPC
|
||||
// specification Section 4.1, we SHOULD NOT one back when "id" == "".
|
||||
return
|
||||
}
|
||||
if len(r.URL.Path) > 1 {
|
||||
|
Reference in New Issue
Block a user