From 0e6d2d1b4b3c733d2ea9b30f27f2fbc5aef52d17 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 6 Apr 2018 19:42:32 +0900 Subject: [PATCH] ing --- protocol/json/server_request.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/protocol/json/server_request.go b/protocol/json/server_request.go index ab7a6bc..3817245 100644 --- a/protocol/json/server_request.go +++ b/protocol/json/server_request.go @@ -130,13 +130,15 @@ func (src *ServerRequestCodec) NewResponse(reply interface{}, err error) ([]byte func (src *ServerRequestCodec) NewResponseWithString(reply string, err error) ([]byte, error) { res := src.newServerResponse(nil, err) - var i interface{} - mErr := json.Unmarshal([]byte(reply), &i) - if nil != mErr { - return nil, mErr - } + if "" != reply { + var i interface{} + mErr := json.Unmarshal([]byte(reply), &i) + if nil != mErr { + return nil, mErr + } - res.Result = i + res.Result = i + } return json.Marshal(res) }