This commit is contained in:
crusader 2018-03-14 15:52:56 +09:00
parent 9c0a3b06a5
commit 82733cc45d

View File

@ -2,11 +2,12 @@ package rpc
import ( import (
"context" "context"
"encoding/json"
"git.loafle.net/commons_go/rpc" "git.loafle.net/commons_go/rpc"
"git.loafle.net/commons_go/rpc/gateway" "git.loafle.net/commons_go/rpc/gateway"
"git.loafle.net/commons_go/rpc/protocol" "git.loafle.net/commons_go/rpc/protocol"
"git.loafle.net/commons_go/rpc/protocol/json" crpj "git.loafle.net/commons_go/rpc/protocol/json"
oogw "git.loafle.net/overflow/overflow_gateway_websocket" oogw "git.loafle.net/overflow/overflow_gateway_websocket"
"git.loafle.net/overflow/overflow_gateway_websocket/external/grpc" "git.loafle.net/overflow/overflow_gateway_websocket/external/grpc"
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
@ -14,7 +15,7 @@ import (
func newGatewayRPCServletHandler() GatewayRPCServletHandler { func newGatewayRPCServletHandler() GatewayRPCServletHandler {
sh := &GatewayRPCServletHandlers{} sh := &GatewayRPCServletHandlers{}
sh.RegisterCodec(json.Name, json.NewServerCodec()) sh.RegisterCodec(crpj.Name, crpj.NewServerCodec())
return sh return sh
} }
@ -36,7 +37,13 @@ func (sh *GatewayRPCServletHandlers) Invoke(servletCTX rpc.ServletContext, reque
return nil, err return nil, err
} }
return r, nil var m interface{}
err = json.Unmarshal([]byte(r), &m)
if err != nil {
return nil, err
}
return m, nil
} }
func (sh *GatewayRPCServletHandlers) Validate() { func (sh *GatewayRPCServletHandlers) Validate() {