We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae74e93 commit 70e5b66Copy full SHA for 70e5b66
1 file changed
go/internal/jsonrpc2/jsonrpc2.go
@@ -454,6 +454,12 @@ func decodeMessage(data []byte) (any, error) {
454
}, nil
455
}
456
if len(msg.ID) > 0 {
457
+ if msg.Error != nil && len(msg.Result) > 0 {
458
+ return nil, fmt.Errorf("response must not contain both result and error: %w", ErrInvalidRequest)
459
+ }
460
+ if msg.Error == nil && len(msg.Result) == 0 {
461
+ return nil, fmt.Errorf("response must contain either result or error: %w", ErrInvalidRequest)
462
463
return &Response{
464
JSONRPC: msg.JSONRPC,
465
ID: msg.ID,
0 commit comments