From 70b50d14bbd219755582147457ef56c3b2384724 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 6 Apr 2018 19:43:55 +0900 Subject: [PATCH] ing --- protocol/json/server_request.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/protocol/json/server_request.go b/protocol/json/server_request.go index 3817245..d23e716 100644 --- a/protocol/json/server_request.go +++ b/protocol/json/server_request.go @@ -2,6 +2,7 @@ package json import ( "encoding/json" + "strings" "git.loafle.net/commons/rpc-go/protocol" cuej "git.loafle.net/commons/util-go/encoding/json" @@ -130,9 +131,10 @@ func (src *ServerRequestCodec) NewResponse(reply interface{}, err error) ([]byte func (src *ServerRequestCodec) NewResponseWithString(reply string, err error) ([]byte, error) { res := src.newServerResponse(nil, err) - if "" != reply { + r := strings.TrimSpace(reply) + if "" != r { var i interface{} - mErr := json.Unmarshal([]byte(reply), &i) + mErr := json.Unmarshal([]byte(r), &i) if nil != mErr { return nil, mErr }