From 3b15bbd34923fcfcb3fd75eadbe560c0cbacff02 Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 14 Mar 2018 20:17:10 +0900 Subject: [PATCH] ing --- protocol/json/server_request.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/protocol/json/server_request.go b/protocol/json/server_request.go index 0e1b593..ba90f3e 100644 --- a/protocol/json/server_request.go +++ b/protocol/json/server_request.go @@ -148,16 +148,21 @@ func (src *ServerRequestCodec) Params() ([]string, error) { var results []string for _, v := range values { - b, err := json.Marshal(v) - if nil != err { - src.err = &Error{ - Code: E_INVALID_REQ, - Message: err.Error(), - Data: src.req.Params, + switch v := v.(type) { + case string: + results = append(results, v) + default: + b, err := json.Marshal(v) + if nil != err { + src.err = &Error{ + Code: E_INVALID_REQ, + Message: err.Error(), + Data: src.req.Params, + } + return nil, src.err } - return nil, src.err + results = append(results, string(b)) } - results = append(results, string(b)) } return results, nil