update tests
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
1fc599fc0d
commit
27bceb82b5
4
go.mod
4
go.mod
@ -13,7 +13,7 @@ require (
|
||||
github.com/unistack-org/micro-api-router-static/v3 v3.2.1
|
||||
github.com/unistack-org/micro-broker-http/v3 v3.3.0
|
||||
github.com/unistack-org/micro-client-grpc/v3 v3.3.1
|
||||
github.com/unistack-org/micro-client-http/v3 v3.3.8
|
||||
github.com/unistack-org/micro-client-http/v3 v3.3.9
|
||||
github.com/unistack-org/micro-codec-grpc/v3 v3.2.1
|
||||
github.com/unistack-org/micro-codec-json/v3 v3.2.1
|
||||
github.com/unistack-org/micro-codec-jsonpb/v3 v3.2.2
|
||||
@ -30,7 +30,7 @@ require (
|
||||
github.com/unistack-org/micro-server-http/v3 v3.3.11
|
||||
github.com/unistack-org/micro-server-tcp/v3 v3.3.0
|
||||
github.com/unistack-org/micro-wrapper-trace-opentracing/v3 v3.2.0
|
||||
github.com/unistack-org/micro/v3 v3.3.14
|
||||
github.com/unistack-org/micro/v3 v3.3.15
|
||||
google.golang.org/genproto v0.0.0-20210416161957-9910b6c460de
|
||||
google.golang.org/grpc v1.37.0
|
||||
google.golang.org/protobuf v1.26.0
|
||||
|
7
go.sum
7
go.sum
@ -457,8 +457,8 @@ github.com/unistack-org/micro-broker-http/v3 v3.3.0 h1:IjdBtcmxl4OniyHG+FAkNoZS9
|
||||
github.com/unistack-org/micro-broker-http/v3 v3.3.0/go.mod h1:soBy700MUOHV5YcyIG949uxqd+FMUinQQr+Qi7ilE4A=
|
||||
github.com/unistack-org/micro-client-grpc/v3 v3.3.1 h1:KP3jBK+R03jffjwWbeMYkzZDIPspuyVGlVxYJxHiYeE=
|
||||
github.com/unistack-org/micro-client-grpc/v3 v3.3.1/go.mod h1:FG7t8s5Jb6VChxyBq75SS9v2/CA6Isikk/tOjtpa+xc=
|
||||
github.com/unistack-org/micro-client-http/v3 v3.3.8 h1:DB/E2GJG7teU3Mw7q+eMqJ1SYf+Hb1wUJ91aIZIjBso=
|
||||
github.com/unistack-org/micro-client-http/v3 v3.3.8/go.mod h1:hOoUW9Z8U3IpsvgLeDSFC51zGeLP3o/fulsfKSa0eO0=
|
||||
github.com/unistack-org/micro-client-http/v3 v3.3.9 h1:tQQ2WoZ1d5D9WO5sm8iQqxbS4N8J6jNtNmXmQa8fXQI=
|
||||
github.com/unistack-org/micro-client-http/v3 v3.3.9/go.mod h1:6rBuxkFO3ccvrYU6nkok7la87kb/O60AFnTQSWb8wZ4=
|
||||
github.com/unistack-org/micro-codec-grpc/v3 v3.2.1 h1:C+9DHTtRSvodlVOFo0+zMhBXoIye/hMleXlRv0o1yIU=
|
||||
github.com/unistack-org/micro-codec-grpc/v3 v3.2.1/go.mod h1:kaEdCPyWsa4o44cD4oS0+KzJWtshlXocZgnzEY+LZHQ=
|
||||
github.com/unistack-org/micro-codec-json/v3 v3.2.1 h1:nMRBnEvCttwX4yPAWuRSAvzcfLazRetqO4DpqJJHjY8=
|
||||
@ -500,8 +500,9 @@ github.com/unistack-org/micro/v3 v3.3.0/go.mod h1:iJwCWq2PECMxigfqe6TPC5GLWvj6P9
|
||||
github.com/unistack-org/micro/v3 v3.3.10/go.mod h1:5ragE2E8ER5d4FZQJG9pB6qdfOoLXLfKW89l77Dy3jQ=
|
||||
github.com/unistack-org/micro/v3 v3.3.11/go.mod h1:PPCt675o3HPcODFbJ4iRWPmQFAk1WQ+asQSOb/syq6U=
|
||||
github.com/unistack-org/micro/v3 v3.3.13/go.mod h1:98hNcMXp/WyWJwLwCuwrhN1Jm7aCWaRNsMfRjK8Fq+Y=
|
||||
github.com/unistack-org/micro/v3 v3.3.14 h1:CAkDMjHZT8/D6GGF5h3gK84m6tlWZC17IGPb2GkAn/4=
|
||||
github.com/unistack-org/micro/v3 v3.3.14/go.mod h1:ETGcQQUcjxGaD44LUMX+0fgo8Loh7ExldfIPLvfUmDo=
|
||||
github.com/unistack-org/micro/v3 v3.3.15 h1:rj+spzhezCg4gmj1nuF0FRGixC51/7xFACOchB/23/E=
|
||||
github.com/unistack-org/micro/v3 v3.3.15/go.mod h1:ETGcQQUcjxGaD44LUMX+0fgo8Loh7ExldfIPLvfUmDo=
|
||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI=
|
||||
|
@ -145,9 +145,17 @@ func (h *Handler) CallDouble(ctx context.Context, req *pb.CallReq, rsp *pb.CallR
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handler) CallRepeated(ctx context.Context, req *pb.CallReq, rsp *pb.CallRsp) error {
|
||||
if len(req.Ids) != 2 || req.Ids[0] != "123" {
|
||||
h.t.Fatalf("invalid reflect merging")
|
||||
func (h *Handler) CallRepeatedString(ctx context.Context, req *pb.CallReq, rsp *pb.CallRsp) error {
|
||||
if len(req.StringIds) != 2 || req.StringIds[0] != "123" {
|
||||
h.t.Fatalf("invalid reflect merging, strings_ids invalid: %v", req.StringIds)
|
||||
}
|
||||
rsp.Rsp = "name_my_name"
|
||||
httpsrv.SetRspCode(ctx, http.StatusCreated)
|
||||
return nil
|
||||
}
|
||||
func (h *Handler) CallRepeatedInt64(ctx context.Context, req *pb.CallReq, rsp *pb.CallRsp) error {
|
||||
if len(req.Int64Ids) != 2 || req.Int64Ids[0] != 123 {
|
||||
h.t.Fatalf("invalid reflect merging, int64_ids invalid: %v", req.Int64Ids)
|
||||
}
|
||||
rsp.Rsp = "name_my_name"
|
||||
httpsrv.SetRspCode(ctx, http.StatusCreated)
|
||||
@ -520,7 +528,7 @@ func TestNativeServer(t *testing.T) {
|
||||
t.Fatalf("Expected response %s, got %s", `{"msg":"my_error"}`, s)
|
||||
}
|
||||
|
||||
rsp, err = http.Post(fmt.Sprintf("http://%s/v1/test/call_repeated/?ids=123&ids=321", service[0].Nodes[0].Address), "application/json", nil)
|
||||
rsp, err = http.Post(fmt.Sprintf("http://%s/v1/test/call_repeated_string/?string_ids=123&string_ids=321", service[0].Nodes[0].Address), "application/json", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -546,7 +554,18 @@ func TestNativeServer(t *testing.T) {
|
||||
c := client.NewClientCallOptions(httpcli.NewClient(client.ContentType("application/json"), client.Codec("application/json", jsoncodec.NewCodec())), client.WithAddress("http://"+service[0].Nodes[0].Address))
|
||||
pbc := pb.NewTestClient("test", c)
|
||||
|
||||
prsp, err := pbc.CallRepeated(context.TODO(), &pb.CallReq{Ids: []string{"123", "321"}})
|
||||
t.Logf("test with string_ids")
|
||||
prsp, err := pbc.CallRepeatedString(context.TODO(), &pb.CallReq{StringIds: []string{"123", "321"}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if prsp.Rsp != "name_my_name" {
|
||||
t.Fatalf("invalid rsp received: %#+v\n", rsp)
|
||||
}
|
||||
|
||||
t.Logf("test with int64_ids")
|
||||
prsp, err = pbc.CallRepeatedInt64(context.TODO(), &pb.CallReq{Int64Ids: []int64{123, 321}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -28,12 +28,13 @@ type CallReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Req string `protobuf:"bytes,2,opt,name=req,proto3" json:"req,omitempty"`
|
||||
Arg1 string `protobuf:"bytes,3,opt,name=arg1,proto3" json:"arg1,omitempty"`
|
||||
Arg2 uint64 `protobuf:"varint,4,opt,name=arg2,proto3" json:"arg2,omitempty"`
|
||||
Nested *Nested `protobuf:"bytes,5,opt,name=nested,proto3" json:"nested,omitempty"`
|
||||
Ids []string `protobuf:"bytes,6,rep,name=ids,proto3" json:"ids,omitempty"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Req string `protobuf:"bytes,2,opt,name=req,proto3" json:"req,omitempty"`
|
||||
Arg1 string `protobuf:"bytes,3,opt,name=arg1,proto3" json:"arg1,omitempty"`
|
||||
Arg2 uint64 `protobuf:"varint,4,opt,name=arg2,proto3" json:"arg2,omitempty"`
|
||||
Nested *Nested `protobuf:"bytes,5,opt,name=nested,proto3" json:"nested,omitempty"`
|
||||
StringIds []string `protobuf:"bytes,6,rep,name=string_ids,json=stringIds,proto3" json:"string_ids,omitempty"`
|
||||
Int64Ids []int64 `protobuf:"varint,7,rep,packed,name=int64_ids,json=int64Ids,proto3" json:"int64_ids,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CallReq) Reset() {
|
||||
@ -103,9 +104,16 @@ func (x *CallReq) GetNested() *Nested {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CallReq) GetIds() []string {
|
||||
func (x *CallReq) GetStringIds() []string {
|
||||
if x != nil {
|
||||
return x.Ids
|
||||
return x.StringIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CallReq) GetInt64Ids() []int64 {
|
||||
if x != nil {
|
||||
return x.Int64Ids
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -370,7 +378,7 @@ var file_test_proto_rawDesc = []byte{
|
||||
0x70, 0x69, 0x76, 0x32, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8f, 0x01, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb9, 0x01, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52,
|
||||
0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x71, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x31,
|
||||
@ -378,64 +386,79 @@ var file_test_proto_rawDesc = []byte{
|
||||
0x61, 0x72, 0x67, 0x32, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x61, 0x72, 0x67, 0x32,
|
||||
0x12, 0x24, 0x0a, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x0c, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x52, 0x06,
|
||||
0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x06, 0x20,
|
||||
0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x68, 0x0a, 0x06, 0x4e, 0x65, 0x73, 0x74,
|
||||
0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x72, 0x67,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41,
|
||||
0x72, 0x67, 0x73, 0x12, 0x3d, 0x0a, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x61, 0x72,
|
||||
0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
|
||||
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36,
|
||||
0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x41, 0x72,
|
||||
0x67, 0x73, 0x22, 0x1b, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x72, 0x73, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x73, 0x70, 0x22,
|
||||
0x30, 0x0a, 0x08, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x72, 0x65, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x65,
|
||||
0x71, 0x22, 0x1c, 0x0a, 0x08, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x31, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x72, 0x73, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x73, 0x70, 0x22,
|
||||
0x19, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x32, 0x97, 0x01, 0x0a, 0x0a, 0x54,
|
||||
0x65, 0x73, 0x74, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x88, 0x01, 0x0a, 0x0a, 0x43, 0x61,
|
||||
0x6c, 0x6c, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x0d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e,
|
||||
0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43,
|
||||
0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x22, 0x5c, 0x92, 0x41, 0x34, 0x2a, 0x04, 0x43, 0x61, 0x6c,
|
||||
0x6c, 0x4a, 0x2c, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a, 0x0e,
|
||||
0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0f,
|
||||
0x0a, 0x0d, 0x1a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x82,
|
||||
0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64,
|
||||
0x6f, 0x75, 0x62, 0x6c, 0x65, 0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x7d, 0x3a, 0x01, 0x2a, 0x32, 0xab, 0x03, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x94, 0x01,
|
||||
0x0a, 0x0c, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x0d,
|
||||
0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
|
||||
0x5f, 0x69, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x72, 0x69,
|
||||
0x6e, 0x67, 0x49, 0x64, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x69,
|
||||
0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x49,
|
||||
0x64, 0x73, 0x22, 0x68, 0x0a, 0x06, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b,
|
||||
0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x67, 0x73, 0x12, 0x3d, 0x0a,
|
||||
0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x52, 0x0a, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x41, 0x72, 0x67, 0x73, 0x22, 0x1b, 0x0a, 0x07,
|
||||
0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x73, 0x70, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x73, 0x70, 0x22, 0x30, 0x0a, 0x08, 0x43, 0x61, 0x6c,
|
||||
0x6c, 0x52, 0x65, 0x71, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x71,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x65, 0x71, 0x22, 0x1c, 0x0a, 0x08, 0x43,
|
||||
0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x31, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x73, 0x70, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x73, 0x70, 0x22, 0x19, 0x0a, 0x05, 0x45, 0x72, 0x72,
|
||||
0x6f, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x6d, 0x73, 0x67, 0x32, 0x97, 0x01, 0x0a, 0x0a, 0x54, 0x65, 0x73, 0x74, 0x44, 0x6f, 0x75,
|
||||
0x62, 0x6c, 0x65, 0x12, 0x88, 0x01, 0x0a, 0x0a, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x6f, 0x75, 0x62,
|
||||
0x6c, 0x65, 0x12, 0x0d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65,
|
||||
0x71, 0x1a, 0x0d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70,
|
||||
0x22, 0x5c, 0x92, 0x41, 0x34, 0x2a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x4a, 0x2c, 0x0a, 0x07, 0x64,
|
||||
0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a, 0x0e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20,
|
||||
0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0f, 0x0a, 0x0d, 0x1a, 0x0b, 0x2e, 0x74,
|
||||
0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22,
|
||||
0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x2f,
|
||||
0x63, 0x61, 0x6c, 0x6c, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x01, 0x2a, 0x32, 0xf2,
|
||||
0x04, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0xae, 0x01, 0x0a, 0x12, 0x43, 0x61, 0x6c, 0x6c,
|
||||
0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x0d,
|
||||
0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e,
|
||||
0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x22, 0x66, 0x92, 0x41,
|
||||
0x3c, 0x2a, 0x0c, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4a,
|
||||
0x2c, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a, 0x0e, 0x45, 0x72,
|
||||
0x72, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0f, 0x0a, 0x0d,
|
||||
0x1a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x82, 0xd3, 0xe4,
|
||||
0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x63, 0x61,
|
||||
0x6c, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x2f, 0x7b, 0x69, 0x64, 0x73,
|
||||
0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x7c, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x0d, 0x2e, 0x74,
|
||||
0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x74, 0x65,
|
||||
0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x22, 0x56, 0x92, 0x41, 0x34, 0x2a,
|
||||
0x04, 0x43, 0x61, 0x6c, 0x6c, 0x4a, 0x2c, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,
|
||||
0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x22, 0x7a, 0x92, 0x41,
|
||||
0x42, 0x2a, 0x12, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53,
|
||||
0x74, 0x72, 0x69, 0x6e, 0x67, 0x4a, 0x2c, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,
|
||||
0x12, 0x21, 0x0a, 0x0e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x0f, 0x0a, 0x0d, 0x1a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72,
|
||||
0x72, 0x6f, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x74,
|
||||
0x65, 0x73, 0x74, 0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a,
|
||||
0x01, 0x2a, 0x12, 0x8d, 0x01, 0x0a, 0x09, 0x43, 0x61, 0x6c, 0x6c, 0x45, 0x72, 0x72, 0x6f, 0x72,
|
||||
0x12, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x31,
|
||||
0x1a, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x31,
|
||||
0x22, 0x60, 0x92, 0x41, 0x39, 0x2a, 0x09, 0x43, 0x61, 0x6c, 0x6c, 0x45, 0x72, 0x72, 0x6f, 0x72,
|
||||
0x4a, 0x2c, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a, 0x0e, 0x45,
|
||||
0x72, 0x72, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0f, 0x0a,
|
||||
0x0d, 0x1a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x82, 0xd3,
|
||||
0xe4, 0x93, 0x02, 0x1e, 0x22, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x63,
|
||||
0x61, 0x6c, 0x6c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a,
|
||||
0x01, 0x2a, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x6d, 0x69,
|
||||
0x63, 0x72, 0x6f, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x2f, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x72, 0x6f, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x22, 0x2a, 0x2f, 0x76, 0x31, 0x2f, 0x74,
|
||||
0x65, 0x73, 0x74, 0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65,
|
||||
0x64, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67,
|
||||
0x5f, 0x69, 0x64, 0x73, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0xaa, 0x01, 0x0a, 0x11, 0x43, 0x61, 0x6c,
|
||||
0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x0d,
|
||||
0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e,
|
||||
0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x22, 0x77, 0x92, 0x41,
|
||||
0x41, 0x2a, 0x11, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x49,
|
||||
0x6e, 0x74, 0x36, 0x34, 0x4a, 0x2c, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12,
|
||||
0x21, 0x0a, 0x0e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x0f, 0x0a, 0x0d, 0x1a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72,
|
||||
0x6f, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x22, 0x28, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65,
|
||||
0x73, 0x74, 0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x5f, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64,
|
||||
0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x2f, 0x7b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x69, 0x64,
|
||||
0x73, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x7c, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x0d, 0x2e,
|
||||
0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x74,
|
||||
0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70, 0x22, 0x56, 0x92, 0x41, 0x34,
|
||||
0x2a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x4a, 0x2c, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
|
||||
0x74, 0x12, 0x21, 0x0a, 0x0e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x0f, 0x0a, 0x0d, 0x1a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45,
|
||||
0x72, 0x72, 0x6f, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f,
|
||||
0x74, 0x65, 0x73, 0x74, 0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d,
|
||||
0x3a, 0x01, 0x2a, 0x12, 0x8d, 0x01, 0x0a, 0x09, 0x43, 0x61, 0x6c, 0x6c, 0x45, 0x72, 0x72, 0x6f,
|
||||
0x72, 0x12, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71,
|
||||
0x31, 0x1a, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x73, 0x70,
|
||||
0x31, 0x22, 0x60, 0x92, 0x41, 0x39, 0x2a, 0x09, 0x43, 0x61, 0x6c, 0x6c, 0x45, 0x72, 0x72, 0x6f,
|
||||
0x72, 0x4a, 0x2c, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a, 0x0e,
|
||||
0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0f,
|
||||
0x0a, 0x0d, 0x1a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x82,
|
||||
0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f,
|
||||
0x63, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d,
|
||||
0x3a, 0x01, 0x2a, 0x42, 0x3a, 0x5a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x6d,
|
||||
0x69, 0x63, 0x72, 0x6f, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x70, 0x62, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -464,15 +487,17 @@ var file_test_proto_depIdxs = []int32{
|
||||
1, // 0: test.CallReq.nested:type_name -> test.Nested
|
||||
6, // 1: test.Nested.uint64_args:type_name -> google.protobuf.UInt64Value
|
||||
0, // 2: test.TestDouble.CallDouble:input_type -> test.CallReq
|
||||
0, // 3: test.Test.CallRepeated:input_type -> test.CallReq
|
||||
0, // 4: test.Test.Call:input_type -> test.CallReq
|
||||
3, // 5: test.Test.CallError:input_type -> test.CallReq1
|
||||
2, // 6: test.TestDouble.CallDouble:output_type -> test.CallRsp
|
||||
2, // 7: test.Test.CallRepeated:output_type -> test.CallRsp
|
||||
2, // 8: test.Test.Call:output_type -> test.CallRsp
|
||||
4, // 9: test.Test.CallError:output_type -> test.CallRsp1
|
||||
6, // [6:10] is the sub-list for method output_type
|
||||
2, // [2:6] is the sub-list for method input_type
|
||||
0, // 3: test.Test.CallRepeatedString:input_type -> test.CallReq
|
||||
0, // 4: test.Test.CallRepeatedInt64:input_type -> test.CallReq
|
||||
0, // 5: test.Test.Call:input_type -> test.CallReq
|
||||
3, // 6: test.Test.CallError:input_type -> test.CallReq1
|
||||
2, // 7: test.TestDouble.CallDouble:output_type -> test.CallRsp
|
||||
2, // 8: test.Test.CallRepeatedString:output_type -> test.CallRsp
|
||||
2, // 9: test.Test.CallRepeatedInt64:output_type -> test.CallRsp
|
||||
2, // 10: test.Test.Call:output_type -> test.CallRsp
|
||||
4, // 11: test.Test.CallError:output_type -> test.CallRsp1
|
||||
7, // [7:12] is the sub-list for method output_type
|
||||
2, // [2:7] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
|
@ -31,9 +31,9 @@ service TestDouble {
|
||||
};
|
||||
|
||||
service Test {
|
||||
rpc CallRepeated(CallReq) returns (CallRsp) {
|
||||
rpc CallRepeatedString(CallReq) returns (CallRsp) {
|
||||
option (micro.openapiv2.openapiv2_operation) = {
|
||||
operation_id: "CallRepeated";
|
||||
operation_id: "CallRepeatedString";
|
||||
responses: {
|
||||
key: "default";
|
||||
value: {
|
||||
@ -46,9 +46,28 @@ service Test {
|
||||
}
|
||||
}
|
||||
};
|
||||
option (micro.api.http) = { post: "/v1/test/call_repeated/{ids}"; body: "*"; };
|
||||
option (micro.api.http) = { post: "/v1/test/call_repeated_string/{string_ids}"; body: "*"; };
|
||||
//option (micro.api.micro_method) = { timeout: 5; };
|
||||
};
|
||||
rpc CallRepeatedInt64(CallReq) returns (CallRsp) {
|
||||
option (micro.openapiv2.openapiv2_operation) = {
|
||||
operation_id: "CallRepeatedInt64";
|
||||
responses: {
|
||||
key: "default";
|
||||
value: {
|
||||
description: "Error response";
|
||||
schema: {
|
||||
json_schema: {
|
||||
ref: ".test.Error";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
option (micro.api.http) = { post: "/v1/test/call_repeated_int64/{int64_ids}"; body: "*"; };
|
||||
//option (micro.api.micro_method) = { timeout: 5; };
|
||||
};
|
||||
|
||||
|
||||
//option (micro.api.micro_service) = { client_wrappers: ["one","two"]; };
|
||||
rpc Call(CallReq) returns (CallRsp) {
|
||||
@ -95,7 +114,8 @@ message CallReq {
|
||||
string arg1 = 3;
|
||||
uint64 arg2 = 4;
|
||||
Nested nested = 5;
|
||||
repeated string ids = 6;
|
||||
repeated string string_ids = 6;
|
||||
repeated int64 int64_ids = 7;
|
||||
};
|
||||
|
||||
message Nested {
|
||||
|
@ -31,8 +31,15 @@ type TestDoubleServer interface {
|
||||
func NewTestEndpoints() []*api.Endpoint {
|
||||
return []*api.Endpoint{
|
||||
&api.Endpoint{
|
||||
Name: "Test.CallRepeated",
|
||||
Path: []string{"/v1/test/call_repeated/{ids}"},
|
||||
Name: "Test.CallRepeatedString",
|
||||
Path: []string{"/v1/test/call_repeated_string/{string_ids}"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
},
|
||||
&api.Endpoint{
|
||||
Name: "Test.CallRepeatedInt64",
|
||||
Path: []string{"/v1/test/call_repeated_int64/{int64_ids}"},
|
||||
Method: []string{"POST"},
|
||||
Body: "*",
|
||||
Handler: "rpc",
|
||||
@ -55,13 +62,15 @@ func NewTestEndpoints() []*api.Endpoint {
|
||||
}
|
||||
|
||||
type TestClient interface {
|
||||
CallRepeated(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error)
|
||||
CallRepeatedString(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error)
|
||||
CallRepeatedInt64(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error)
|
||||
Call(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error)
|
||||
CallError(ctx context.Context, req *CallReq1, opts ...client.CallOption) (*CallRsp1, error)
|
||||
}
|
||||
|
||||
type TestServer interface {
|
||||
CallRepeated(ctx context.Context, req *CallReq, rsp *CallRsp) error
|
||||
CallRepeatedString(ctx context.Context, req *CallReq, rsp *CallRsp) error
|
||||
CallRepeatedInt64(ctx context.Context, req *CallReq, rsp *CallRsp) error
|
||||
Call(ctx context.Context, req *CallReq, rsp *CallRsp) error
|
||||
CallError(ctx context.Context, req *CallReq1, rsp *CallRsp1) error
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func NewTestClient(name string, c client.Client) TestClient {
|
||||
return &testClient{c: c, name: name}
|
||||
}
|
||||
|
||||
func (c *testClient) CallRepeated(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error) {
|
||||
func (c *testClient) CallRepeatedString(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &Error{}
|
||||
opts = append(opts,
|
||||
@ -79,11 +79,30 @@ func (c *testClient) CallRepeated(ctx context.Context, req *CallReq, opts ...cli
|
||||
)
|
||||
opts = append(opts,
|
||||
v3.Method(http.MethodPost),
|
||||
v3.Path("/v1/test/call_repeated/{ids}"),
|
||||
v3.Path("/v1/test/call_repeated_string/{string_ids}"),
|
||||
v3.Body("*"),
|
||||
)
|
||||
rsp := &CallRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.CallRepeated", req), rsp, opts...)
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.CallRepeatedString", req), rsp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *testClient) CallRepeatedInt64(ctx context.Context, req *CallReq, opts ...client.CallOption) (*CallRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &Error{}
|
||||
opts = append(opts,
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v3.Method(http.MethodPost),
|
||||
v3.Path("/v1/test/call_repeated_int64/{int64_ids}"),
|
||||
v3.Body("*"),
|
||||
)
|
||||
rsp := &CallRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.CallRepeatedInt64", req), rsp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -132,8 +151,12 @@ type testServer struct {
|
||||
TestServer
|
||||
}
|
||||
|
||||
func (h *testServer) CallRepeated(ctx context.Context, req *CallReq, rsp *CallRsp) error {
|
||||
return h.TestServer.CallRepeated(ctx, req, rsp)
|
||||
func (h *testServer) CallRepeatedString(ctx context.Context, req *CallReq, rsp *CallRsp) error {
|
||||
return h.TestServer.CallRepeatedString(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *testServer) CallRepeatedInt64(ctx context.Context, req *CallReq, rsp *CallRsp) error {
|
||||
return h.TestServer.CallRepeatedInt64(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *testServer) Call(ctx context.Context, req *CallReq, rsp *CallRsp) error {
|
||||
@ -146,7 +169,8 @@ func (h *testServer) CallError(ctx context.Context, req *CallReq1, rsp *CallRsp1
|
||||
|
||||
func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOption) error {
|
||||
type test interface {
|
||||
CallRepeated(ctx context.Context, req *CallReq, rsp *CallRsp) error
|
||||
CallRepeatedString(ctx context.Context, req *CallReq, rsp *CallRsp) error
|
||||
CallRepeatedInt64(ctx context.Context, req *CallReq, rsp *CallRsp) error
|
||||
Call(ctx context.Context, req *CallReq, rsp *CallRsp) error
|
||||
CallError(ctx context.Context, req *CallReq1, rsp *CallRsp1) error
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ func TestMergeString(t *testing.T) {
|
||||
mp["bool"] = true
|
||||
s := &str{}
|
||||
|
||||
t.Logf("merge with true")
|
||||
if err := rutil.Merge(s, mp, rutil.Tags([]string{"json"})); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -71,7 +72,7 @@ func TestMergeString(t *testing.T) {
|
||||
}
|
||||
|
||||
mp["bool"] = false
|
||||
|
||||
t.Logf("merge with false")
|
||||
if err := rutil.Merge(s, mp, rutil.Tags([]string{"json"})); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user