jsonrpc メソッドが空の応答を返すのはなぜですか?
type Args struct {
A, B int
}
type Response struct {
sum int
message string
}
type Arith int
func (t *Arith) Add(r *http.Request, args *Args, reply *Response) error {
reply.sum = args.A + args.B
reply.message = "Do math"
// this does not work either
//*reply = Response{
// sum : 12,
// message : "Do math",
//}
return nil
}
リクエスト:
{"method":"Arith.Add","params":[{"A": 10, "B":2}], "id": 1}
応答:
{
"result": {},
"error": null,
"id": 1
}
ただし、のタイプを に設定するreplyと*string、これは正常に機能します。
*reply = "Responding with strings works"
応答:
{
"result": "Responding with strings works",
"error": null,
"id": 1
}