diff --git a/integration_tests/integration_test.ts b/integration_tests/integration_test.ts index 20d3ae8..bfbf462 100644 --- a/integration_tests/integration_test.ts +++ b/integration_tests/integration_test.ts @@ -52,5 +52,8 @@ describe("test grpc-gateway-ts communication", () => { expect(getField(result, 'patch_result')).to.equal(33) }) - + it('http get request with url search parameters', async () => { + const result = await CounterService.HTTPGetWithURLSearchParams({a: 10, post: {b: 11}, c: [23, 25], external: {d: 12}}, {pathPrefix: "http://localhost:8081"}) + expect(getField(result, 'patch_result')).to.equal(81) + }) }) diff --git a/integration_tests/msg.pb.go b/integration_tests/msg.pb.go index 4d144bd..6a23ebd 100644 --- a/integration_tests/msg.pb.go +++ b/integration_tests/msg.pb.go @@ -25,6 +25,53 @@ const ( // of the legacy proto package is being used. const _ = proto.ProtoPackageIsVersion4 +type ExternalMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + D int32 `protobuf:"varint,1,opt,name=d,proto3" json:"d,omitempty"` +} + +func (x *ExternalMessage) Reset() { + *x = ExternalMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_msg_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExternalMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExternalMessage) ProtoMessage() {} + +func (x *ExternalMessage) ProtoReflect() protoreflect.Message { + mi := &file_msg_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExternalMessage.ProtoReflect.Descriptor instead. +func (*ExternalMessage) Descriptor() ([]byte, []int) { + return file_msg_proto_rawDescGZIP(), []int{0} +} + +func (x *ExternalMessage) GetD() int32 { + if x != nil { + return x.D + } + return 0 +} + type ExternalRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -36,7 +83,7 @@ type ExternalRequest struct { func (x *ExternalRequest) Reset() { *x = ExternalRequest{} if protoimpl.UnsafeEnabled { - mi := &file_msg_proto_msgTypes[0] + mi := &file_msg_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -49,7 +96,7 @@ func (x *ExternalRequest) String() string { func (*ExternalRequest) ProtoMessage() {} func (x *ExternalRequest) ProtoReflect() protoreflect.Message { - mi := &file_msg_proto_msgTypes[0] + mi := &file_msg_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -62,7 +109,7 @@ func (x *ExternalRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ExternalRequest.ProtoReflect.Descriptor instead. func (*ExternalRequest) Descriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{0} + return file_msg_proto_rawDescGZIP(), []int{1} } func (x *ExternalRequest) GetContent() string { @@ -83,7 +130,7 @@ type ExternalResponse struct { func (x *ExternalResponse) Reset() { *x = ExternalResponse{} if protoimpl.UnsafeEnabled { - mi := &file_msg_proto_msgTypes[1] + mi := &file_msg_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96,7 +143,7 @@ func (x *ExternalResponse) String() string { func (*ExternalResponse) ProtoMessage() {} func (x *ExternalResponse) ProtoReflect() protoreflect.Message { - mi := &file_msg_proto_msgTypes[1] + mi := &file_msg_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109,7 +156,7 @@ func (x *ExternalResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ExternalResponse.ProtoReflect.Descriptor instead. func (*ExternalResponse) Descriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{1} + return file_msg_proto_rawDescGZIP(), []int{2} } func (x *ExternalResponse) GetResult() string { @@ -122,14 +169,16 @@ func (x *ExternalResponse) GetResult() string { var File_msg_proto protoreflect.FileDescriptor var file_msg_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x0f, 0x45, - 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, - 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x2a, 0x0a, 0x10, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x3b, 0x6d, 0x61, 0x69, 0x6e, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1f, 0x0a, 0x0f, 0x45, + 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0c, + 0x0a, 0x01, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x64, 0x22, 0x2b, 0x0a, 0x0f, + 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x2a, 0x0a, 0x10, 0x45, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x3b, 0x6d, 0x61, 0x69, 0x6e, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -144,10 +193,11 @@ func file_msg_proto_rawDescGZIP() []byte { return file_msg_proto_rawDescData } -var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_msg_proto_goTypes = []interface{}{ - (*ExternalRequest)(nil), // 0: ExternalRequest - (*ExternalResponse)(nil), // 1: ExternalResponse + (*ExternalMessage)(nil), // 0: ExternalMessage + (*ExternalRequest)(nil), // 1: ExternalRequest + (*ExternalResponse)(nil), // 2: ExternalResponse } var file_msg_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -164,7 +214,7 @@ func file_msg_proto_init() { } if !protoimpl.UnsafeEnabled { file_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExternalRequest); i { + switch v := v.(*ExternalMessage); i { case 0: return &v.state case 1: @@ -176,6 +226,18 @@ func file_msg_proto_init() { } } file_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExternalRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ExternalResponse); i { case 0: return &v.state @@ -194,7 +256,7 @@ func file_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/integration_tests/msg.proto b/integration_tests/msg.proto index 1e8f935..61ea8e8 100644 --- a/integration_tests/msg.proto +++ b/integration_tests/msg.proto @@ -1,6 +1,10 @@ -syntax = "proto3"; +syntax = "proto3"; option go_package = "./;main"; +message ExternalMessage { + int32 d = 1; +} + message ExternalRequest { string content = 1; } diff --git a/integration_tests/service.go b/integration_tests/service.go index 687e42b..8fdc977 100644 --- a/integration_tests/service.go +++ b/integration_tests/service.go @@ -61,3 +61,13 @@ func (r *RealCounterService) HTTPPatch(ctx context.Context, in *HttpPatchRequest PatchResult: in.A + in.C, }, nil } + +func (r *RealCounterService) HTTPGetWithURLSearchParams(ctx context.Context, in *HTTPGetWithURLSearchParamsRequest) (*HTTPGetWithURLSearchParamsResponse, error) { + totalC := 0 + for _, c := range in.C { + totalC += int(c) + } + return &HTTPGetWithURLSearchParamsResponse{ + UrlSearchParamsResult: in.A + in.Post.B + in.External.D + int32(totalC), + }, nil +} diff --git a/integration_tests/service.pb.go b/integration_tests/service.pb.go index b97e7e4..4b830ed 100644 --- a/integration_tests/service.pb.go +++ b/integration_tests/service.pb.go @@ -571,6 +571,124 @@ func (x *HttpPatchResponse) GetPatchResult() int32 { return 0 } +type HTTPGetWithURLSearchParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + A int32 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` + Post *PostRequest `protobuf:"bytes,2,opt,name=post,proto3" json:"post,omitempty"` + C []int32 `protobuf:"varint,3,rep,packed,name=c,proto3" json:"c,omitempty"` + External *ExternalMessage `protobuf:"bytes,4,opt,name=external,proto3" json:"external,omitempty"` +} + +func (x *HTTPGetWithURLSearchParamsRequest) Reset() { + *x = HTTPGetWithURLSearchParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HTTPGetWithURLSearchParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HTTPGetWithURLSearchParamsRequest) ProtoMessage() {} + +func (x *HTTPGetWithURLSearchParamsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HTTPGetWithURLSearchParamsRequest.ProtoReflect.Descriptor instead. +func (*HTTPGetWithURLSearchParamsRequest) Descriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{11} +} + +func (x *HTTPGetWithURLSearchParamsRequest) GetA() int32 { + if x != nil { + return x.A + } + return 0 +} + +func (x *HTTPGetWithURLSearchParamsRequest) GetPost() *PostRequest { + if x != nil { + return x.Post + } + return nil +} + +func (x *HTTPGetWithURLSearchParamsRequest) GetC() []int32 { + if x != nil { + return x.C + } + return nil +} + +func (x *HTTPGetWithURLSearchParamsRequest) GetExternal() *ExternalMessage { + if x != nil { + return x.External + } + return nil +} + +type HTTPGetWithURLSearchParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UrlSearchParamsResult int32 `protobuf:"varint,1,opt,name=url_search_params_result,json=urlSearchParamsResult,proto3" json:"url_search_params_result,omitempty"` +} + +func (x *HTTPGetWithURLSearchParamsResponse) Reset() { + *x = HTTPGetWithURLSearchParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HTTPGetWithURLSearchParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HTTPGetWithURLSearchParamsResponse) ProtoMessage() {} + +func (x *HTTPGetWithURLSearchParamsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HTTPGetWithURLSearchParamsResponse.ProtoReflect.Descriptor instead. +func (*HTTPGetWithURLSearchParamsResponse) Descriptor() ([]byte, []int) { + return file_service_proto_rawDescGZIP(), []int{12} +} + +func (x *HTTPGetWithURLSearchParamsResponse) GetUrlSearchParamsResult() int32 { + if x != nil { + return x.UrlSearchParamsResult + } + return 0 +} + var File_service_proto protoreflect.FileDescriptor var file_service_proto_rawDesc = []byte{ @@ -611,43 +729,67 @@ var file_service_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x63, 0x22, 0x36, 0x0a, 0x11, 0x48, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0b, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, - 0xbb, 0x04, 0x0a, 0x0e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x12, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x55, 0x6e, 0x61, 0x72, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x13, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, - 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x30, 0x01, 0x12, 0x56, 0x0a, 0x07, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x12, 0x14, 0x2e, - 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x7b, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x6f, - 0x5f, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x7d, 0x12, 0x63, 0x0a, 0x1a, 0x48, 0x54, - 0x54, 0x50, 0x50, 0x6f, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, - 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x15, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, - 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x22, - 0x09, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2f, 0x7b, 0x61, 0x7d, 0x3a, 0x03, 0x72, 0x65, 0x71, 0x12, - 0x63, 0x0a, 0x18, 0x48, 0x54, 0x54, 0x50, 0x50, 0x6f, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x53, - 0x74, 0x61, 0x72, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x15, 0x2e, 0x6d, 0x61, - 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x12, 0x22, 0x0d, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2f, 0x7b, 0x61, 0x7d, 0x2f, 0x7b, 0x63, - 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x4f, 0x0a, 0x09, 0x48, 0x54, 0x54, 0x50, 0x50, 0x61, 0x74, 0x63, - 0x68, 0x12, 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, - 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, - 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x32, 0x06, 0x2f, 0x70, 0x61, 0x74, - 0x63, 0x68, 0x3a, 0x01, 0x2a, 0x12, 0x36, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x10, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x45, 0x78, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x5a, + 0x28, 0x05, 0x52, 0x0b, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, + 0x94, 0x01, 0x0a, 0x21, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x55, + 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x01, 0x61, 0x12, 0x25, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x63, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x01, 0x63, 0x12, 0x2c, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x45, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x65, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x22, 0x5d, 0x0a, 0x22, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, + 0x74, 0x57, 0x69, 0x74, 0x68, 0x55, 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x18, + 0x75, 0x72, 0x6c, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x15, + 0x75, 0x72, 0x6c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xc5, 0x05, 0x0a, 0x0e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x49, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x55, 0x6e, 0x61, + 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6d, 0x61, 0x69, 0x6e, + 0x2e, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, + 0x0a, 0x13, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, + 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x56, 0x0a, 0x07, 0x48, 0x54, 0x54, 0x50, + 0x47, 0x65, 0x74, 0x12, 0x14, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6d, 0x61, 0x69, 0x6e, + 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x7b, + 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x6f, 0x5f, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x7d, + 0x12, 0x63, 0x0a, 0x1a, 0x48, 0x54, 0x54, 0x50, 0x50, 0x6f, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, + 0x4e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x74, 0x68, 0x12, 0x15, + 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, + 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x22, 0x09, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2f, 0x7b, 0x61, 0x7d, + 0x3a, 0x03, 0x72, 0x65, 0x71, 0x12, 0x63, 0x0a, 0x18, 0x48, 0x54, 0x54, 0x50, 0x50, 0x6f, 0x73, + 0x74, 0x57, 0x69, 0x74, 0x68, 0x53, 0x74, 0x61, 0x72, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x74, + 0x68, 0x12, 0x15, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, + 0x48, 0x74, 0x74, 0x70, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x22, 0x0d, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2f, + 0x7b, 0x61, 0x7d, 0x2f, 0x7b, 0x63, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x4f, 0x0a, 0x09, 0x48, 0x54, + 0x54, 0x50, 0x50, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, + 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x63, 0x68, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, + 0x32, 0x06, 0x2f, 0x70, 0x61, 0x74, 0x63, 0x68, 0x3a, 0x01, 0x2a, 0x12, 0x36, 0x0a, 0x0f, 0x45, + 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x10, + 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x11, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x87, 0x01, 0x0a, 0x1a, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x57, + 0x69, 0x74, 0x68, 0x55, 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x27, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, + 0x74, 0x57, 0x69, 0x74, 0x68, 0x55, 0x52, 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6d, 0x61, + 0x69, 0x6e, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x47, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x55, 0x52, + 0x4c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x7b, 0x61, 0x7d, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x3b, 0x6d, 0x61, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } @@ -663,43 +805,50 @@ func file_service_proto_rawDescGZIP() []byte { return file_service_proto_rawDescData } -var file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_service_proto_goTypes = []interface{}{ - (*UnaryRequest)(nil), // 0: main.UnaryRequest - (*UnaryResponse)(nil), // 1: main.UnaryResponse - (*StreamingRequest)(nil), // 2: main.StreamingRequest - (*StreamingResponse)(nil), // 3: main.StreamingResponse - (*HttpGetRequest)(nil), // 4: main.HttpGetRequest - (*HttpGetResponse)(nil), // 5: main.HttpGetResponse - (*HttpPostRequest)(nil), // 6: main.HttpPostRequest - (*PostRequest)(nil), // 7: main.PostRequest - (*HttpPostResponse)(nil), // 8: main.HttpPostResponse - (*HttpPatchRequest)(nil), // 9: main.HttpPatchRequest - (*HttpPatchResponse)(nil), // 10: main.HttpPatchResponse - (*ExternalRequest)(nil), // 11: ExternalRequest - (*ExternalResponse)(nil), // 12: ExternalResponse + (*UnaryRequest)(nil), // 0: main.UnaryRequest + (*UnaryResponse)(nil), // 1: main.UnaryResponse + (*StreamingRequest)(nil), // 2: main.StreamingRequest + (*StreamingResponse)(nil), // 3: main.StreamingResponse + (*HttpGetRequest)(nil), // 4: main.HttpGetRequest + (*HttpGetResponse)(nil), // 5: main.HttpGetResponse + (*HttpPostRequest)(nil), // 6: main.HttpPostRequest + (*PostRequest)(nil), // 7: main.PostRequest + (*HttpPostResponse)(nil), // 8: main.HttpPostResponse + (*HttpPatchRequest)(nil), // 9: main.HttpPatchRequest + (*HttpPatchResponse)(nil), // 10: main.HttpPatchResponse + (*HTTPGetWithURLSearchParamsRequest)(nil), // 11: main.HTTPGetWithURLSearchParamsRequest + (*HTTPGetWithURLSearchParamsResponse)(nil), // 12: main.HTTPGetWithURLSearchParamsResponse + (*ExternalMessage)(nil), // 13: ExternalMessage + (*ExternalRequest)(nil), // 14: ExternalRequest + (*ExternalResponse)(nil), // 15: ExternalResponse } var file_service_proto_depIdxs = []int32{ 7, // 0: main.HttpPostRequest.req:type_name -> main.PostRequest - 0, // 1: main.CounterService.Increment:input_type -> main.UnaryRequest - 2, // 2: main.CounterService.StreamingIncrements:input_type -> main.StreamingRequest - 4, // 3: main.CounterService.HTTPGet:input_type -> main.HttpGetRequest - 6, // 4: main.CounterService.HTTPPostWithNestedBodyPath:input_type -> main.HttpPostRequest - 6, // 5: main.CounterService.HTTPPostWithStarBodyPath:input_type -> main.HttpPostRequest - 9, // 6: main.CounterService.HTTPPatch:input_type -> main.HttpPatchRequest - 11, // 7: main.CounterService.ExternalMessage:input_type -> ExternalRequest - 1, // 8: main.CounterService.Increment:output_type -> main.UnaryResponse - 3, // 9: main.CounterService.StreamingIncrements:output_type -> main.StreamingResponse - 5, // 10: main.CounterService.HTTPGet:output_type -> main.HttpGetResponse - 8, // 11: main.CounterService.HTTPPostWithNestedBodyPath:output_type -> main.HttpPostResponse - 8, // 12: main.CounterService.HTTPPostWithStarBodyPath:output_type -> main.HttpPostResponse - 10, // 13: main.CounterService.HTTPPatch:output_type -> main.HttpPatchResponse - 12, // 14: main.CounterService.ExternalMessage:output_type -> ExternalResponse - 8, // [8:15] is the sub-list for method output_type - 1, // [1:8] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 7, // 1: main.HTTPGetWithURLSearchParamsRequest.post:type_name -> main.PostRequest + 13, // 2: main.HTTPGetWithURLSearchParamsRequest.external:type_name -> ExternalMessage + 0, // 3: main.CounterService.Increment:input_type -> main.UnaryRequest + 2, // 4: main.CounterService.StreamingIncrements:input_type -> main.StreamingRequest + 4, // 5: main.CounterService.HTTPGet:input_type -> main.HttpGetRequest + 6, // 6: main.CounterService.HTTPPostWithNestedBodyPath:input_type -> main.HttpPostRequest + 6, // 7: main.CounterService.HTTPPostWithStarBodyPath:input_type -> main.HttpPostRequest + 9, // 8: main.CounterService.HTTPPatch:input_type -> main.HttpPatchRequest + 14, // 9: main.CounterService.ExternalMessage:input_type -> ExternalRequest + 11, // 10: main.CounterService.HTTPGetWithURLSearchParams:input_type -> main.HTTPGetWithURLSearchParamsRequest + 1, // 11: main.CounterService.Increment:output_type -> main.UnaryResponse + 3, // 12: main.CounterService.StreamingIncrements:output_type -> main.StreamingResponse + 5, // 13: main.CounterService.HTTPGet:output_type -> main.HttpGetResponse + 8, // 14: main.CounterService.HTTPPostWithNestedBodyPath:output_type -> main.HttpPostResponse + 8, // 15: main.CounterService.HTTPPostWithStarBodyPath:output_type -> main.HttpPostResponse + 10, // 16: main.CounterService.HTTPPatch:output_type -> main.HttpPatchResponse + 15, // 17: main.CounterService.ExternalMessage:output_type -> ExternalResponse + 12, // 18: main.CounterService.HTTPGetWithURLSearchParams:output_type -> main.HTTPGetWithURLSearchParamsResponse + 11, // [11:19] is the sub-list for method output_type + 3, // [3:11] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_service_proto_init() } @@ -841,6 +990,30 @@ func file_service_proto_init() { return nil } } + file_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HTTPGetWithURLSearchParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HTTPGetWithURLSearchParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -848,7 +1021,7 @@ func file_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_service_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 13, NumExtensions: 0, NumServices: 1, }, @@ -881,6 +1054,7 @@ type CounterServiceClient interface { HTTPPostWithStarBodyPath(ctx context.Context, in *HttpPostRequest, opts ...grpc.CallOption) (*HttpPostResponse, error) HTTPPatch(ctx context.Context, in *HttpPatchRequest, opts ...grpc.CallOption) (*HttpPatchResponse, error) ExternalMessage(ctx context.Context, in *ExternalRequest, opts ...grpc.CallOption) (*ExternalResponse, error) + HTTPGetWithURLSearchParams(ctx context.Context, in *HTTPGetWithURLSearchParamsRequest, opts ...grpc.CallOption) (*HTTPGetWithURLSearchParamsResponse, error) } type counterServiceClient struct { @@ -977,6 +1151,15 @@ func (c *counterServiceClient) ExternalMessage(ctx context.Context, in *External return out, nil } +func (c *counterServiceClient) HTTPGetWithURLSearchParams(ctx context.Context, in *HTTPGetWithURLSearchParamsRequest, opts ...grpc.CallOption) (*HTTPGetWithURLSearchParamsResponse, error) { + out := new(HTTPGetWithURLSearchParamsResponse) + err := c.cc.Invoke(ctx, "/main.CounterService/HTTPGetWithURLSearchParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // CounterServiceServer is the server API for CounterService service. type CounterServiceServer interface { Increment(context.Context, *UnaryRequest) (*UnaryResponse, error) @@ -986,6 +1169,7 @@ type CounterServiceServer interface { HTTPPostWithStarBodyPath(context.Context, *HttpPostRequest) (*HttpPostResponse, error) HTTPPatch(context.Context, *HttpPatchRequest) (*HttpPatchResponse, error) ExternalMessage(context.Context, *ExternalRequest) (*ExternalResponse, error) + HTTPGetWithURLSearchParams(context.Context, *HTTPGetWithURLSearchParamsRequest) (*HTTPGetWithURLSearchParamsResponse, error) } // UnimplementedCounterServiceServer can be embedded to have forward compatible implementations. @@ -1013,6 +1197,9 @@ func (*UnimplementedCounterServiceServer) HTTPPatch(context.Context, *HttpPatchR func (*UnimplementedCounterServiceServer) ExternalMessage(context.Context, *ExternalRequest) (*ExternalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ExternalMessage not implemented") } +func (*UnimplementedCounterServiceServer) HTTPGetWithURLSearchParams(context.Context, *HTTPGetWithURLSearchParamsRequest) (*HTTPGetWithURLSearchParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HTTPGetWithURLSearchParams not implemented") +} func RegisterCounterServiceServer(s *grpc.Server, srv CounterServiceServer) { s.RegisterService(&_CounterService_serviceDesc, srv) @@ -1147,6 +1334,24 @@ func _CounterService_ExternalMessage_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _CounterService_HTTPGetWithURLSearchParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HTTPGetWithURLSearchParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CounterServiceServer).HTTPGetWithURLSearchParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/main.CounterService/HTTPGetWithURLSearchParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CounterServiceServer).HTTPGetWithURLSearchParams(ctx, req.(*HTTPGetWithURLSearchParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _CounterService_serviceDesc = grpc.ServiceDesc{ ServiceName: "main.CounterService", HandlerType: (*CounterServiceServer)(nil), @@ -1175,6 +1380,10 @@ var _CounterService_serviceDesc = grpc.ServiceDesc{ MethodName: "ExternalMessage", Handler: _CounterService_ExternalMessage_Handler, }, + { + MethodName: "HTTPGetWithURLSearchParams", + Handler: _CounterService_HTTPGetWithURLSearchParams_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/integration_tests/service.pb.gw.go b/integration_tests/service.pb.gw.go index dcbc9f7..6b2aaed 100644 --- a/integration_tests/service.pb.gw.go +++ b/integration_tests/service.pb.gw.go @@ -394,6 +394,78 @@ func local_request_CounterService_ExternalMessage_0(ctx context.Context, marshal } +var ( + filter_CounterService_HTTPGetWithURLSearchParams_0 = &utilities.DoubleArray{Encoding: map[string]int{"a": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_CounterService_HTTPGetWithURLSearchParams_0(ctx context.Context, marshaler runtime.Marshaler, client CounterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HTTPGetWithURLSearchParamsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CounterService_HTTPGetWithURLSearchParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.HTTPGetWithURLSearchParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_CounterService_HTTPGetWithURLSearchParams_0(ctx context.Context, marshaler runtime.Marshaler, server CounterServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq HTTPGetWithURLSearchParamsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["a"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "a") + } + + protoReq.A, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "a", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CounterService_HTTPGetWithURLSearchParams_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.HTTPGetWithURLSearchParams(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterCounterServiceHandlerServer registers the http handlers for service CounterService to "mux". // UnaryRPC :call CounterServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -545,6 +617,29 @@ func RegisterCounterServiceHandlerServer(ctx context.Context, mux *runtime.Serve }) + mux.Handle("GET", pattern_CounterService_HTTPGetWithURLSearchParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_CounterService_HTTPGetWithURLSearchParams_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CounterService_HTTPGetWithURLSearchParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -726,6 +821,26 @@ func RegisterCounterServiceHandlerClient(ctx context.Context, mux *runtime.Serve }) + mux.Handle("GET", pattern_CounterService_HTTPGetWithURLSearchParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_CounterService_HTTPGetWithURLSearchParams_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_CounterService_HTTPGetWithURLSearchParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -743,6 +858,8 @@ var ( pattern_CounterService_HTTPPatch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"patch"}, "", runtime.AssumeColonVerbOpt(true))) pattern_CounterService_ExternalMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"main.CounterService", "ExternalMessage"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_CounterService_HTTPGetWithURLSearchParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"api", "query", "a"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -759,4 +876,6 @@ var ( forward_CounterService_HTTPPatch_0 = runtime.ForwardResponseMessage forward_CounterService_ExternalMessage_0 = runtime.ForwardResponseMessage + + forward_CounterService_HTTPGetWithURLSearchParams_0 = runtime.ForwardResponseMessage ) diff --git a/integration_tests/service.proto b/integration_tests/service.proto index 7797ee8..0e99f44 100644 --- a/integration_tests/service.proto +++ b/integration_tests/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package main; -option go_package = "./;main"; +option go_package = "./;main"; import "google/api/annotations.proto"; import "msg.proto"; @@ -30,9 +30,9 @@ message HttpGetResponse { } message HttpPostRequest { - int32 a = 1; + int32 a = 1; PostRequest req = 2; - int32 c = 3; + int32 c = 3; } message PostRequest { @@ -52,6 +52,17 @@ message HttpPatchResponse { int32 patch_result = 2; } +message HTTPGetWithURLSearchParamsRequest { + int32 a = 1; + PostRequest post = 2; + repeated int32 c = 3; + ExternalMessage external = 4; +} + +message HTTPGetWithURLSearchParamsResponse { + int32 url_search_params_result = 1; +} + service CounterService { rpc Increment(UnaryRequest) returns (UnaryResponse); rpc StreamingIncrements(StreamingRequest) returns (stream StreamingResponse); @@ -79,4 +90,10 @@ service CounterService { }; } rpc ExternalMessage(ExternalRequest) returns (ExternalResponse); + rpc HTTPGetWithURLSearchParams(HTTPGetWithURLSearchParamsRequest) + returns (HTTPGetWithURLSearchParamsResponse) { + option (google.api.http) = { + get: "/api/query/{a}" + }; + } }