This commit is contained in:
crusader 2017-10-27 14:08:58 +09:00
parent cbd9ce0150
commit 9f519e728e
2 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package json
import ( import (
"encoding/json" "encoding/json"
"io" "io"
"log"
"git.loafle.net/commons_go/rpc/encode" "git.loafle.net/commons_go/rpc/encode"
"git.loafle.net/commons_go/rpc/protocol" "git.loafle.net/commons_go/rpc/protocol"
@ -84,6 +85,7 @@ func newCodecRequest(r io.Reader, encoder encode.Encoder) protocol.CodecRequest
// Decode the request body and check if RPC method is valid. // Decode the request body and check if RPC method is valid.
req := new(serverRequest) req := new(serverRequest)
err := json.NewDecoder(r).Decode(req) err := json.NewDecoder(r).Decode(req)
log.Printf("NewRequest err: %v", err)
if err != nil { if err != nil {
err = &Error{ err = &Error{
Code: E_PARSE, Code: E_PARSE,

View File

@ -103,7 +103,7 @@ func (rr *rpcRegistry) Invoke(contentType string, r io.Reader, w io.Writer, befo
// Create a new codec request. // Create a new codec request.
codecReq := codec.NewRequest(r) codecReq := codec.NewRequest(r)
// Get service method to be called. // Get service method to be called.
log.Print("codecReq.Method") log.Printf("codecReq.Method: %v", codecReq)
method, errMethod := codecReq.Method() method, errMethod := codecReq.Method()
if errMethod != nil { if errMethod != nil {
return write(codecReq, w, beforeWrite, afterWrite, nil, errMethod) return write(codecReq, w, beforeWrite, afterWrite, nil, errMethod)