Browse Source

优化修改jsonrpc2模块代码

niujiuru 2 weeks atrás
parent
commit
8ce72c64d9
1 changed files with 4 additions and 0 deletions
  1. 4 0
      utils/jsonrpc2/rpc.go

+ 4 - 0
utils/jsonrpc2/rpc.go

@@ -74,6 +74,10 @@ func ParseRequest(input any) (*Request, error) {
 		return nil, errors.New(`"jsonrpc" must be "2.0"`)
 	}
 
+	if req.Method == "" {
+		return nil, errors.New("method must be non-empty")
+	}
+
 	return &req, nil
 }