From 4c75b69bb9e2a865b5d2a6f1edd353407c943fca Mon Sep 17 00:00:00 2001 From: chaos Date: Fri, 2 Dec 2022 13:12:02 +0900 Subject: [PATCH] #221202 --- test/stream/server.pb.go | 132 ++++++++---------------------------- test/stream/server.pb.gw.go | 15 ++-- test/stream/server.proto | 8 +-- 3 files changed, 39 insertions(+), 116 deletions(-) diff --git a/test/stream/server.pb.go b/test/stream/server.pb.go index b488556..40f5949 100644 --- a/test/stream/server.pb.go +++ b/test/stream/server.pb.go @@ -168,7 +168,6 @@ type GetURLResponse struct { unknownFields protoimpl.UnknownFields Content []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` - Url *Url `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` } func (x *GetURLResponse) Reset() { @@ -210,60 +209,6 @@ func (x *GetURLResponse) GetContent() []byte { return nil } -func (x *GetURLResponse) GetUrl() *Url { - if x != nil { - return x.Url - } - return nil -} - -type Url struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GifUrl string `protobuf:"bytes,1,opt,name=gif_url,json=gifUrl,proto3" json:"gif_url,omitempty"` -} - -func (x *Url) Reset() { - *x = Url{} - if protoimpl.UnsafeEnabled { - mi := &file_test_stream_server_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Url) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Url) ProtoMessage() {} - -func (x *Url) ProtoReflect() protoreflect.Message { - mi := &file_test_stream_server_proto_msgTypes[4] - 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 Url.ProtoReflect.Descriptor instead. -func (*Url) Descriptor() ([]byte, []int) { - return file_test_stream_server_proto_rawDescGZIP(), []int{4} -} - -func (x *Url) GetGifUrl() string { - if x != nil { - return x.GifUrl - } - return "" -} - var File_test_stream_server_proto protoreflect.FileDescriptor var file_test_stream_server_proto_rawDesc = []byte{ @@ -279,30 +224,25 @@ var file_test_stream_server_proto_rawDesc = []byte{ 0x03, 0x75, 0x72, 0x6c, 0x22, 0x2b, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x22, 0x4b, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x74, 0x22, 0x2a, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, - 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x76, 0x30, 0x2e, - 0x63, 0x68, 0x61, 0x6f, 0x73, 0x2e, 0x55, 0x72, 0x6c, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x1e, - 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x67, 0x69, 0x66, 0x5f, 0x75, 0x72, 0x6c, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x69, 0x66, 0x55, 0x72, 0x6c, 0x32, 0xcd, - 0x01, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x62, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x18, 0x2e, 0x76, 0x30, - 0x2e, 0x63, 0x68, 0x61, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x76, 0x30, 0x2e, 0x63, 0x68, 0x61, 0x6f, 0x73, - 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x7b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x7d, 0x30, 0x01, 0x12, 0x58, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x55, 0x52, 0x4c, 0x12, 0x17, - 0x2e, 0x76, 0x30, 0x2e, 0x63, 0x68, 0x61, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x52, 0x4c, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x76, 0x30, 0x2e, 0x63, 0x68, 0x61, - 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x0c, 0x2f, 0x74, 0x65, 0x73, 0x74, - 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x3a, 0x03, 0x75, 0x72, 0x6c, 0x30, 0x01, 0x42, 0x2d, - 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x65, 0x61, - 0x75, 0x74, 0x69, 0x66, 0x75, 0x6c, 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x67, 0x72, 0x70, - 0x63, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x32, 0xc8, 0x01, + 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x62, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x18, 0x2e, 0x76, 0x30, 0x2e, + 0x63, 0x68, 0x61, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x76, 0x30, 0x2e, 0x63, 0x68, 0x61, 0x6f, 0x73, 0x2e, + 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x7b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x7d, 0x30, 0x01, 0x12, 0x53, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x55, 0x52, 0x4c, 0x12, 0x17, 0x2e, + 0x76, 0x30, 0x2e, 0x63, 0x68, 0x61, 0x6f, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x52, 0x4c, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x76, 0x30, 0x2e, 0x63, 0x68, 0x61, 0x6f, + 0x73, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x52, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x30, 0x01, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x65, 0x61, 0x75, 0x74, 0x69, 0x66, 0x75, 0x6c, + 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x65, 0x73, 0x74, + 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -317,25 +257,23 @@ func file_test_stream_server_proto_rawDescGZIP() []byte { return file_test_stream_server_proto_rawDescData } -var file_test_stream_server_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_test_stream_server_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_test_stream_server_proto_goTypes = []interface{}{ (*GetFileRequest)(nil), // 0: v0.chaos.GetFileRequest (*GetURLRequest)(nil), // 1: v0.chaos.GetURLRequest (*GetFileResponse)(nil), // 2: v0.chaos.GetFileResponse (*GetURLResponse)(nil), // 3: v0.chaos.GetURLResponse - (*Url)(nil), // 4: v0.chaos.Url } var file_test_stream_server_proto_depIdxs = []int32{ - 4, // 0: v0.chaos.GetURLResponse.url:type_name -> v0.chaos.Url - 0, // 1: v0.chaos.StreamService.GetFile:input_type -> v0.chaos.GetFileRequest - 1, // 2: v0.chaos.StreamService.GetURL:input_type -> v0.chaos.GetURLRequest - 2, // 3: v0.chaos.StreamService.GetFile:output_type -> v0.chaos.GetFileResponse - 3, // 4: v0.chaos.StreamService.GetURL:output_type -> v0.chaos.GetURLResponse - 3, // [3:5] is the sub-list for method output_type - 1, // [1:3] 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 + 0, // 0: v0.chaos.StreamService.GetFile:input_type -> v0.chaos.GetFileRequest + 1, // 1: v0.chaos.StreamService.GetURL:input_type -> v0.chaos.GetURLRequest + 2, // 2: v0.chaos.StreamService.GetFile:output_type -> v0.chaos.GetFileResponse + 3, // 3: v0.chaos.StreamService.GetURL:output_type -> v0.chaos.GetURLResponse + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_test_stream_server_proto_init() } @@ -392,18 +330,6 @@ func file_test_stream_server_proto_init() { return nil } } - file_test_stream_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Url); 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{ @@ -411,7 +337,7 @@ func file_test_stream_server_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_test_stream_server_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/test/stream/server.pb.gw.go b/test/stream/server.pb.gw.go index 86ec22b..e3cb403 100644 --- a/test/stream/server.pb.gw.go +++ b/test/stream/server.pb.gw.go @@ -65,15 +65,18 @@ func request_StreamService_GetFile_0(ctx context.Context, marshaler runtime.Mars } +var ( + filter_StreamService_GetURL_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + func request_StreamService_GetURL_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_GetURLClient, runtime.ServerMetadata, error) { var protoReq GetURLRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Url); err != nil && err != io.EOF { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_StreamService_GetURL_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -103,7 +106,7 @@ func RegisterStreamServiceHandlerServer(ctx context.Context, mux *runtime.ServeM return }) - mux.Handle("POST", pattern_StreamService_GetURL_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_StreamService_GetURL_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -173,7 +176,7 @@ func RegisterStreamServiceHandlerClient(ctx context.Context, mux *runtime.ServeM }) - mux.Handle("POST", pattern_StreamService_GetURL_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_StreamService_GetURL_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) diff --git a/test/stream/server.proto b/test/stream/server.proto index b8e8552..b38faa7 100644 --- a/test/stream/server.proto +++ b/test/stream/server.proto @@ -14,8 +14,7 @@ service StreamService { } rpc GetURL(GetURLRequest) returns (stream GetURLResponse) { option (google.api.http) = { - post: "/test/stream" - body: "url" + get: "/test/stream" }; } } @@ -34,9 +33,4 @@ message GetFileResponse { message GetURLResponse { bytes content = 1; - Url url = 2; -} - -message Url { - string gif_url = 1; } \ No newline at end of file