update tests and deps for micro http client/server

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-10-27 13:17:06 +03:00
parent a6b5ee450f
commit bb75d12542
6 changed files with 145 additions and 75 deletions

5
go.mod
View File

@ -13,7 +13,7 @@ require (
go.unistack.org/micro-broker-kgo/v3 v3.8.1
go.unistack.org/micro-broker-segmentio/v3 v3.8.0
go.unistack.org/micro-client-grpc/v3 v3.8.0
go.unistack.org/micro-client-http/v3 v3.8.1
go.unistack.org/micro-client-http/v3 v3.8.2
go.unistack.org/micro-codec-grpc/v3 v3.8.1
go.unistack.org/micro-codec-json/v3 v3.8.0
go.unistack.org/micro-codec-jsonpb/v3 v3.8.1
@ -33,9 +33,8 @@ require (
go.unistack.org/micro-wrapper-recovery/v3 v3.8.0
go.unistack.org/micro-wrapper-sql/v3 v3.0.0-00010101000000-000000000000
go.unistack.org/micro-wrapper-trace-opentracing/v3 v3.8.0
go.unistack.org/micro/v3 v3.8.5
go.unistack.org/micro/v3 v3.8.6
google.golang.org/grpc v1.40.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 // indirect
google.golang.org/protobuf v1.27.1
modernc.org/sqlite v1.13.3
storj.io/drpc v0.0.26

9
go.sum
View File

@ -408,8 +408,8 @@ go.unistack.org/micro-broker-segmentio/v3 v3.8.0 h1:Nm9BaS4eD6kuewHRGmUd/QFbdv4F
go.unistack.org/micro-broker-segmentio/v3 v3.8.0/go.mod h1:Q3mavh0ZoNRO6mw31USvE760lDWB1nQHWiE64F6s8rs=
go.unistack.org/micro-client-grpc/v3 v3.8.0 h1:Dp92KVt2GGQoEqG1D0VAvLyOjsPKdsqILUdBYkVfSCw=
go.unistack.org/micro-client-grpc/v3 v3.8.0/go.mod h1:nu91OnGLuIeEcHhHOJu5NiLt6I2SprE3mEC3uYsZ0pM=
go.unistack.org/micro-client-http/v3 v3.8.1 h1:AK80AOt5SGha9MczJSo133rFEcKqKVKa0Kg3qvdS2bI=
go.unistack.org/micro-client-http/v3 v3.8.1/go.mod h1:hNsweSkl+etv+OK2d4E1nzME7isjeq2RD19JXe3c5tk=
go.unistack.org/micro-client-http/v3 v3.8.2 h1:QfnBosAx1/niIx2VUFnb5Q4h0bfoH8pnCCNE/EeCw2Y=
go.unistack.org/micro-client-http/v3 v3.8.2/go.mod h1:hNsweSkl+etv+OK2d4E1nzME7isjeq2RD19JXe3c5tk=
go.unistack.org/micro-codec-grpc/v3 v3.8.1 h1:vZrR07L8NKziG1dtzCBKoooaHpV3oP2c7rh93ClbUGI=
go.unistack.org/micro-codec-grpc/v3 v3.8.1/go.mod h1:RawS1ObPRsjsdvDXrGcLNnTexOHdU9yRZbF4QhWkRWw=
go.unistack.org/micro-codec-json/v3 v3.8.0 h1:sQ6xdHaNUCxCiUakGaV1t8lbX1rGWlgnF/HbsXyhkGg=
@ -449,8 +449,9 @@ go.unistack.org/micro-wrapper-trace-opentracing/v3 v3.8.0/go.mod h1:+QJ8gVq8CG/6
go.unistack.org/micro/v3 v3.8.0/go.mod h1:Tkteri0wiiybbH6aPqay26pZHFIAwL9LXJc2x1Jkakk=
go.unistack.org/micro/v3 v3.8.2/go.mod h1:Tkteri0wiiybbH6aPqay26pZHFIAwL9LXJc2x1Jkakk=
go.unistack.org/micro/v3 v3.8.4/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA=
go.unistack.org/micro/v3 v3.8.5 h1:DIYWRsQF+NPhKZP45sCtNsUhaRw6u2+Ps7U+pKU7i3s=
go.unistack.org/micro/v3 v3.8.5/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA=
go.unistack.org/micro/v3 v3.8.6 h1:nU6dpNRF7iF8dtcTTfzdPan8RkhiDuTsfMrXBmpzG/g=
go.unistack.org/micro/v3 v3.8.6/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA=
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@ -605,8 +606,6 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=

View File

@ -203,6 +203,9 @@ func (h *Handler) Call(ctx context.Context, req *pb.CallReq, rsp *pb.CallRsp) er
if req.Name != "my_name" {
h.t.Fatalf("invalid req received: %#+v", req)
}
if req.Clientid != "1234567890" {
h.t.Fatalf("invalid req recevided %#+v", req)
}
rsp.Rsp = "name_my_name"
httpsrv.SetRspCode(ctx, http.StatusCreated)
md = metadata.New(1)
@ -267,6 +270,8 @@ func TestNativeFormUrlencoded(t *testing.T) {
// make request
req, err := http.NewRequest(http.MethodPost, fmt.Sprintf("http://%s/v1/test/call/my_name", service[0].Nodes[0].Address), strings.NewReader(data.Encode())) // URL-encoded payload
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
req.Header.Add("Clientid", "1234567890")
req.AddCookie(&http.Cookie{Name:"Csrftoken", Value: "csrftoken"})
// req.Header.Add("Content-Length", strconv.Itoa(len(data.Encode())))
if err != nil {
t.Fatal(err)
@ -309,6 +314,8 @@ func TestNativeFormUrlencoded(t *testing.T) {
nrsp, err := svc1.Call(ctx, &pb.CallReq{
Name: "my_name",
Arg1: "arg1val",
Clientid: "1234567890",
Csrftoken: "csrftoken",
Nested: &pb.Nested{Uint64Args: []*wrapperspb.UInt64Value{
&wrapperspb.UInt64Value{Value: 1},
&wrapperspb.UInt64Value{Value: 2},
@ -394,8 +401,11 @@ func TestNativeClientServer(t *testing.T) {
cli := client.NewClientCallOptions(httpcli.NewClient(client.ContentType("application/json"), client.Codec("application/json", jsonpbcodec.NewCodec())), client.WithAddress(fmt.Sprintf("http://%s", service[0].Nodes[0].Address)))
svc1 := pb.NewTestClient("helloworld", cli)
rsp, err := svc1.Call(ctx, &pb.CallReq{
Name: "my_name",
Clientid: "1234567890",
Csrftoken: "csrftoken",
Nested: &pb.Nested{Uint64Args: []*wrapperspb.UInt64Value{
&wrapperspb.UInt64Value{Value: 1},
&wrapperspb.UInt64Value{Value: 2},
@ -415,6 +425,8 @@ func TestNativeClientServer(t *testing.T) {
}
hb, err := jsonpbcodec.NewCodec().Marshal(&pb.CallReq{
Clientid: "1234567890",
Csrftoken: "csrftoken",
Nested: &pb.Nested{Uint64Args: []*wrapperspb.UInt64Value{
&wrapperspb.UInt64Value{Value: 1},
&wrapperspb.UInt64Value{Value: 2},

View File

@ -36,6 +36,8 @@ type CallReq struct {
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"`
Clientid string `protobuf:"bytes,8,opt,name=Clientid,proto3" json:"Clientid,omitempty"`
Csrftoken string `protobuf:"bytes,9,opt,name=Csrftoken,proto3" json:"Csrftoken,omitempty"`
}
func (x *CallReq) Reset() {
@ -119,6 +121,20 @@ func (x *CallReq) GetInt64Ids() []int64 {
return nil
}
func (x *CallReq) GetClientid() string {
if x != nil {
return x.Clientid
}
return ""
}
func (x *CallReq) GetCsrftoken() string {
if x != nil {
return x.Csrftoken
}
return ""
}
type Nested struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -380,7 +396,7 @@ var file_test_proto_rawDesc = []byte{
0x69, 0x76, 0x33, 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, 0xcb, 0x01, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x02, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65,
0x71, 0x12, 0x24, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42,
0x10, 0x9a, 0x84, 0x9e, 0x03, 0x0b, 0x78, 0x6d, 0x6c, 0x3a, 0x22, 0x2c, 0x61, 0x74, 0x74, 0x72,
0x22, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x71, 0x18, 0x02,
@ -393,67 +409,76 @@ var file_test_proto_rawDesc = []byte{
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, 0x8a, 0x01, 0x0a, 0x0a, 0x54, 0x65, 0x73, 0x74, 0x44, 0x6f,
0x75, 0x62, 0x6c, 0x65, 0x12, 0x7c, 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, 0x50, 0xaa, 0x84, 0x9e, 0x03, 0x19, 0x2a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x42, 0x11, 0x0a,
0x0f, 0x12, 0x0d, 0x0a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72,
0xb2, 0xea, 0xff, 0xf9, 0x01, 0x24, 0x22, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74,
0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x2f, 0x6e, 0x61, 0x6d, 0x65,
0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x18,
0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x12,
0x1c, 0x0a, 0x09, 0x43, 0x73, 0x72, 0x66, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x43, 0x73, 0x72, 0x66, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 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,
0x8a, 0x01, 0x0a, 0x0a, 0x54, 0x65, 0x73, 0x74, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x7c,
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, 0x50, 0xaa, 0x84, 0x9e, 0x03,
0x19, 0x2a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x42, 0x11, 0x0a, 0x0f, 0x12, 0x0d, 0x0a, 0x0b, 0x2e,
0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x24,
0x22, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65,
0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,
0x7d, 0x3a, 0x01, 0x2a, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05, 0x32, 0xd9, 0x04, 0x0a,
0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x90, 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, 0x5c, 0xaa, 0x84, 0x9e, 0x03,
0x27, 0x2a, 0x12, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x53,
0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x11, 0x0a, 0x0f, 0x12, 0x0d, 0x0a, 0x0b, 0x2e, 0x74, 0x65,
0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x22, 0x22, 0x1d,
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, 0x3a, 0x01, 0x2a,
0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05, 0x12, 0x8d, 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, 0x5a, 0xaa, 0x84,
0x9e, 0x03, 0x26, 0x2a, 0x11, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65,
0x64, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x42, 0x11, 0x0a, 0x0f, 0x12, 0x0d, 0x0a, 0x0b, 0x2e, 0x74,
0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea, 0xff, 0xf9, 0x01, 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, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x3a, 0x01, 0x2a,
0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05, 0x12, 0xb7, 0x01, 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,
0x90, 0x01, 0xaa, 0x84, 0x9e, 0x03, 0x64, 0x2a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x32, 0x23, 0x0a,
0x21, 0x0a, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x12, 0x06, 0x68, 0x65, 0x61,
0x64, 0x65, 0x72, 0x20, 0x01, 0x52, 0x0b, 0x0a, 0x09, 0xca, 0x01, 0x06, 0x73, 0x74, 0x72, 0x69,
0x6e, 0x67, 0x32, 0x24, 0x0a, 0x22, 0x0a, 0x09, 0x43, 0x73, 0x72, 0x66, 0x74, 0x6f, 0x6b, 0x65,
0x6e, 0x12, 0x06, 0x63, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x20, 0x01, 0x52, 0x0b, 0x0a, 0x09, 0xca,
0x01, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x11, 0x0a, 0x0f, 0x12, 0x0d, 0x0a, 0x0b,
0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea, 0xff, 0xf9, 0x01,
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, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x02,
0x08, 0x05, 0x32, 0x8c, 0x04, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x90, 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, 0x5c, 0xaa, 0x84, 0x9e, 0x03, 0x27, 0x2a, 0x12, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x70,
0x65, 0x61, 0x74, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x11, 0x0a, 0x0f, 0x12,
0x0d, 0x0a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea,
0xff, 0xf9, 0x01, 0x22, 0x22, 0x1d, 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, 0x3a, 0x01, 0x2a, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05, 0x12, 0x8d,
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, 0x5a, 0xaa, 0x84, 0x9e, 0x03, 0x26, 0x2a, 0x11, 0x43, 0x61, 0x6c, 0x6c, 0x52,
0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x42, 0x11, 0x0a, 0x0f,
0x12, 0x0d, 0x0a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0xb2,
0xea, 0xff, 0xf9, 0x01, 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, 0x5f, 0x69, 0x6e,
0x74, 0x36, 0x34, 0x3a, 0x01, 0x2a, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05, 0x12, 0x6b,
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, 0x45, 0xaa, 0x84, 0x9e, 0x03, 0x19, 0x2a, 0x04, 0x43, 0x61, 0x6c,
0x6c, 0x42, 0x11, 0x0a, 0x0f, 0x12, 0x0d, 0x0a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45,
0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea, 0xff, 0xf9, 0x01, 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, 0xba, 0xea, 0xff, 0xf9, 0x01, 0x02, 0x08, 0x05, 0x12, 0x74, 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, 0x47, 0xaa, 0x84, 0x9e, 0x03, 0x1e, 0x2a,
0x09, 0x43, 0x61, 0x6c, 0x6c, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x11, 0x0a, 0x0f, 0x12, 0x0d,
0x0a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea, 0xff,
0xf9, 0x01, 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, 0x32, 0x5a, 0x30, 0x67, 0x6f, 0x2e, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b,
0x2e, 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,
0x08, 0x05, 0x12, 0x74, 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,
0x47, 0xaa, 0x84, 0x9e, 0x03, 0x1e, 0x2a, 0x09, 0x43, 0x61, 0x6c, 0x6c, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x42, 0x11, 0x0a, 0x0f, 0x12, 0x0d, 0x0a, 0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x45,
0x72, 0x72, 0x6f, 0x72, 0xb2, 0xea, 0xff, 0xf9, 0x01, 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, 0x32, 0x5a, 0x30, 0x67, 0x6f, 0x2e, 0x75,
0x6e, 0x69, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 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 (

View File

@ -68,6 +68,30 @@ service Test {
_ref: ".test.Error";
};
};
};
parameters: {
parameter: {
name: "Clientid";
in: "header";
schema: {
schema: {
type: "string";
};
};
required: true;
};
};
parameters: {
parameter: {
name: "Csrftoken";
in: "cookie";
schema: {
schema: {
type: "string";
};
};
required: true;
};
};
};
option (micro.api.http) = { post: "/v1/test/call/{name}"; body: "*"; };
@ -97,6 +121,8 @@ message CallReq {
Nested nested = 5;
repeated string string_ids = 6;
repeated int64 int64_ids = 7;
string Clientid = 8;
string Csrftoken = 9;
};
message Nested {

View File

@ -7,6 +7,7 @@ package pb
import (
context "context"
v3 "go.unistack.org/micro-client-http/v3"
v31 "go.unistack.org/micro-server-http/v3"
api "go.unistack.org/micro/v3/api"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
@ -109,6 +110,10 @@ func (c *testClient) Call(ctx context.Context, req *CallReq, opts ...client.Call
v3.Path("/v1/test/call/{name}"),
v3.Body("*"),
)
opts = append(opts,
v3.Cookie("Csrftoken", "true"),
v3.Header("Clientid", "true"),
)
opts = append(opts, client.WithRequestTimeout(time.Second*5))
rsp := &CallRsp{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Test.Call", req), rsp, opts...)
@ -154,6 +159,10 @@ func (h *testServer) Call(ctx context.Context, req *CallReq, rsp *CallRsp) error
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
defer cancel()
v31.FillRequest(ctx, req,
v31.Header("Clientid", "true"),
v31.Cookie("Csrftoken", "true"),
)
return h.TestServer.Call(ctx, req, rsp)
}