Prevent removing "result" field on JSON RPC Result
@@ -5,8 +5,9 @@ import (
"net/http"
"sync"
- "github.com/icon-project/goloop/common/errors"
"github.com/labstack/echo/v4"
+
+ "github.com/icon-project/goloop/common/errors"
)
type Handler func(ctx *Context, params *Params) (result interface{}, err error)
@@ -93,9 +94,13 @@ func (mr *MethodRepository) handle(ctx *Context, raw json.RawMessage) *Response
} else {
resp.Error = ErrorCodeInternal.Wrap(err, debug)
}
+ } else {
+ if res == nil {
+ resp.Result = json.RawMessage("null")
} else {
resp.Result = res
}
+ }
if req.ID == nil {
return nil
}
