ing
This commit is contained in:
parent
0e6d2d1b4b
commit
70b50d14bb
|
@ -2,6 +2,7 @@ package json
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"git.loafle.net/commons/rpc-go/protocol"
|
"git.loafle.net/commons/rpc-go/protocol"
|
||||||
cuej "git.loafle.net/commons/util-go/encoding/json"
|
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) {
|
func (src *ServerRequestCodec) NewResponseWithString(reply string, err error) ([]byte, error) {
|
||||||
res := src.newServerResponse(nil, err)
|
res := src.newServerResponse(nil, err)
|
||||||
|
|
||||||
if "" != reply {
|
r := strings.TrimSpace(reply)
|
||||||
|
if "" != r {
|
||||||
var i interface{}
|
var i interface{}
|
||||||
mErr := json.Unmarshal([]byte(reply), &i)
|
mErr := json.Unmarshal([]byte(r), &i)
|
||||||
if nil != mErr {
|
if nil != mErr {
|
||||||
return nil, mErr
|
return nil, mErr
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user