fix(transport/grpc): remove autoprefixing logic
Removes the autoprefixing of "pb" to service names, to allow for
grpc services created without a package prefix.
Fixes #447.
BREAKING CHANGE: Existing users of the grpc client transport who were
relying on the autoprefixing of the "pb" package name must manually
update their clients to add it. No change is required if a package name
was already being manually prefixed.
Terin Stock
6 years ago
33 | 33 |
{
|
34 | 34 |
sumEndpoint = grpctransport.NewClient(
|
35 | 35 |
conn,
|
36 | |
"Add",
|
|
36 |
"pb.Add",
|
37 | 37 |
"Sum",
|
38 | 38 |
addsvc.EncodeGRPCSumRequest,
|
39 | 39 |
addsvc.DecodeGRPCSumResponse,
|
|
52 | 52 |
{
|
53 | 53 |
concatEndpoint = grpctransport.NewClient(
|
54 | 54 |
conn,
|
55 | |
"Add",
|
|
55 |
"pb.Add",
|
56 | 56 |
"Concat",
|
57 | 57 |
addsvc.EncodeGRPCConcatRequest,
|
58 | 58 |
addsvc.DecodeGRPCConcatResponse,
|
3 | 3 |
"context"
|
4 | 4 |
"fmt"
|
5 | 5 |
"reflect"
|
6 | |
"strings"
|
7 | 6 |
|
8 | 7 |
"google.golang.org/grpc"
|
9 | 8 |
"google.golang.org/grpc/metadata"
|
|
36 | 35 |
grpcReply interface{},
|
37 | 36 |
options ...ClientOption,
|
38 | 37 |
) *Client {
|
39 | |
if strings.IndexByte(serviceName, '.') == -1 {
|
40 | |
serviceName = "pb." + serviceName
|
41 | |
}
|
42 | 38 |
c := &Client{
|
43 | 39 |
client: cc,
|
44 | 40 |
method: fmt.Sprintf("/%s/%s", serviceName, method),
|