@@ -91,37 +91,37 @@ func run(ctx context.Context, t *testing.T, r io.ReadCloser, w io.WriteCloser) *
91
91
return conn
92
92
}
93
93
94
- func handle (ctx context.Context , c * jsonrpc2. Conn , r * jsonrpc2.Request ) {
94
+ func handle (ctx context.Context , r * jsonrpc2.Request ) {
95
95
switch r .Method {
96
96
case "no_args" :
97
97
if r .Params != nil {
98
- c .Reply (ctx , r , nil , jsonrpc2 .Errorf (jsonrpc2 .CodeInvalidParams , "Expected no params" ))
98
+ r .Reply (ctx , nil , jsonrpc2 .Errorf (jsonrpc2 .InvalidParams , "Expected no params" ))
99
99
return
100
100
}
101
- c .Reply (ctx , r , true , nil )
101
+ r .Reply (ctx , true , nil )
102
102
case "one_string" :
103
103
var v string
104
104
if err := json .Unmarshal (* r .Params , & v ); err != nil {
105
- c .Reply (ctx , r , nil , jsonrpc2 .Errorf (jsonrpc2 .CodeParseError , "%v" , err .Error ()))
105
+ r .Reply (ctx , nil , jsonrpc2 .Errorf (jsonrpc2 .ParseError , "%v" , err .Error ()))
106
106
return
107
107
}
108
- c .Reply (ctx , r , "got:" + v , nil )
108
+ r .Reply (ctx , "got:" + v , nil )
109
109
case "one_number" :
110
110
var v int
111
111
if err := json .Unmarshal (* r .Params , & v ); err != nil {
112
- c .Reply (ctx , r , nil , jsonrpc2 .Errorf (jsonrpc2 .CodeParseError , "%v" , err .Error ()))
112
+ r .Reply (ctx , nil , jsonrpc2 .Errorf (jsonrpc2 .ParseError , "%v" , err .Error ()))
113
113
return
114
114
}
115
- c .Reply (ctx , r , fmt .Sprintf ("got:%d" , v ), nil )
115
+ r .Reply (ctx , fmt .Sprintf ("got:%d" , v ), nil )
116
116
case "join" :
117
117
var v []string
118
118
if err := json .Unmarshal (* r .Params , & v ); err != nil {
119
- c .Reply (ctx , r , nil , jsonrpc2 .Errorf (jsonrpc2 .CodeParseError , "%v" , err .Error ()))
119
+ r .Reply (ctx , nil , jsonrpc2 .Errorf (jsonrpc2 .ParseError , "%v" , err .Error ()))
120
120
return
121
121
}
122
- c .Reply (ctx , r , path .Join (v ... ), nil )
122
+ r .Reply (ctx , path .Join (v ... ), nil )
123
123
default :
124
- c .Reply (ctx , r , nil , jsonrpc2 .Errorf (jsonrpc2 .CodeMethodNotFound , "method %q not found" , r .Method ))
124
+ r .Reply (ctx , nil , jsonrpc2 .Errorf (jsonrpc2 .MethodNotFound , "method %q not found" , r .Method ))
125
125
}
126
126
}
127
127
0 commit comments