diff --git a/protocol/json/client.go b/protocol/json/client.go index 4330e01..933572b 100644 --- a/protocol/json/client.go +++ b/protocol/json/client.go @@ -110,8 +110,8 @@ func newClientCodecResponseOrNotify(r io.Reader, encoder encode.Encoder) (protoc ccrn := retainClientCodecResponseOrNotify() - if res, err := newClientCodecResponse(raw, dec); nil != err { - notify, err := newClientCodecNotify(raw, dec) + if res, err := newClientCodecResponse(raw); nil != err { + notify, err := newClientCodecNotify(raw) if nil != err { releaseClientCodecResponseOrNotify(ccrn) return nil, fmt.Errorf("Is not response or notification [%v]", raw) diff --git a/protocol/json/client_notify.go b/protocol/json/client_notify.go index 158f773..dbcd33d 100644 --- a/protocol/json/client_notify.go +++ b/protocol/json/client_notify.go @@ -13,10 +13,10 @@ import ( // ---------------------------------------------------------------------------- // newCodecRequest returns a new ClientCodecNotify. -func newClientCodecNotify(raw json.RawMessage, decoder *json.Decoder) (protocol.ClientCodecNotify, error) { +func newClientCodecNotify(raw json.RawMessage) (protocol.ClientCodecNotify, error) { // Decode the request body and check if RPC method is valid. ccn := retainClientCodecNotify() - err := decoder.Decode(&ccn.notify) + err := json.Unmarshal(raw, &ccn.notify) if err != nil { releaseClientCodecNotify(ccn) return nil, err diff --git a/protocol/json/client_response.go b/protocol/json/client_response.go index 8c12bda..f1398e7 100644 --- a/protocol/json/client_response.go +++ b/protocol/json/client_response.go @@ -13,10 +13,10 @@ import ( // ---------------------------------------------------------------------------- // newClientCodecResponse returns a new ClientCodecResponse. -func newClientCodecResponse(raw json.RawMessage, decoder *json.Decoder) (protocol.ClientCodecResponse, error) { +func newClientCodecResponse(raw json.RawMessage) (protocol.ClientCodecResponse, error) { // Decode the request body and check if RPC method is valid. ccr := retainClientCodecResponse() - err := decoder.Decode(&ccr.response) + err := json.Unmarshal(raw, &ccr.response) if err != nil { releaseClientCodecResponse(ccr) return nil, err