From 187d3369136ad5eec16b92b639a8f38adb41c875 Mon Sep 17 00:00:00 2001 From: Ivan <2103732+codebien@users.noreply.github.com> Date: Thu, 14 Apr 2022 15:50:04 +0200 Subject: [PATCH] Use Empty message for NoOp request --- lib/netext/grpcext/conn_test.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/netext/grpcext/conn_test.go b/lib/netext/grpcext/conn_test.go index e89332f049c..861ff32ff88 100644 --- a/lib/netext/grpcext/conn_test.go +++ b/lib/netext/grpcext/conn_test.go @@ -57,7 +57,7 @@ func TestInvokeWithCallOptions(t *testing.T) { c := Conn{raw: invokemock(reply)} r := Request{ MethodDescriptor: methodFromProto("NoOp"), - Message: []byte(`{"greeting":"text request"}`), + Message: []byte(`{}`), } res, err := c.Invoke(context.Background(), "/hello.HelloService/NoOp", metadata.New(nil), r, grpc.UseCompressor("fakeone")) require.NoError(t, err) @@ -133,6 +133,14 @@ func TestConnInvokeInvalid(t *testing.T) { req: Request{MethodDescriptor: methodDesc}, experr: "message is required", }, + { + name: "EmptyMessage", + ctx: ctx, + url: url, + md: nil, + req: Request{MethodDescriptor: methodDesc, Message: []byte{}}, + experr: "message is required", + }, } for _, tt := range tests { @@ -261,7 +269,7 @@ package hello; service HelloService { rpc SayHello(HelloRequest) returns (HelloResponse); - rpc NoOp(HelloRequest) returns (Empty); + rpc NoOp(Empty) returns (Empty); rpc LotsOfReplies(HelloRequest) returns (stream HelloResponse); rpc LotsOfGreetings(stream HelloRequest) returns (HelloResponse); rpc BidiHello(stream HelloRequest) returns (stream HelloResponse);