Browse Source

[rpc] do not try to parse params if they were not provided (Refs #708)

pull/724/head
Anton Kaliaev 7 years ago
parent
commit
a3adac3787
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      rpc/lib/server/handlers.go

+ 6
- 2
rpc/lib/server/handlers.go View File

@ -534,9 +534,13 @@ func (wsc *wsConnection) readRoutine() {
var args []reflect.Value var args []reflect.Value
if rpcFunc.ws { if rpcFunc.ws {
wsCtx := types.WSRPCContext{Request: request, WSRPCConnection: wsc} wsCtx := types.WSRPCContext{Request: request, WSRPCConnection: wsc}
args, err = jsonParamsToArgsWS(rpcFunc, request.Params, wsCtx)
if request.Params != nil {
args, err = jsonParamsToArgsWS(rpcFunc, request.Params, wsCtx)
}
} else { } else {
args, err = jsonParamsToArgsRPC(rpcFunc, request.Params)
if request.Params != nil {
args, err = jsonParamsToArgsRPC(rpcFunc, request.Params)
}
} }
if err != nil { if err != nil {
wsc.WriteRPCResponse(types.RPCInternalError(request.ID, errors.Wrap(err, "Error converting json params to arguments"))) wsc.WriteRPCResponse(types.RPCInternalError(request.ID, errors.Wrap(err, "Error converting json params to arguments")))


Loading…
Cancel
Save