Skip to content

Commit

Permalink
Use Empty message for NoOp request
Browse files Browse the repository at this point in the history
  • Loading branch information
codebien committed Apr 21, 2022
1 parent d54954d commit 187d336
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/netext/grpcext/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 187d336

Please sign in to comment.