1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +02:00

fixing string field contains invalid UTF-8 issue (#2164)

This commit is contained in:
Johnson C
2021-05-10 18:25:31 +08:00
committed by GitHub
parent 9e9157d878
commit 8c9c7a5927
2 changed files with 6 additions and 4 deletions

View File

@ -56,7 +56,7 @@ func (s *testServer) CallPcreInvalid(ctx context.Context, req *pb.Request, rsp *
// TestHello implements helloworld.GreeterServer
func (s *testServer) Call(ctx context.Context, req *pb.Request, rsp *pb.Response) error {
if req.Name == "Error" {
return &errors.Error{Id: "1", Code: 99, Detail: "detail"}
return &errors.Error{Id: "1", Code: 99, Detail: "detail\xc5"}
}
rsp.Msg = "Hello " + req.Name
@ -196,7 +196,7 @@ func TestGRPCServer(t *testing.T) {
if !ok {
t.Fatalf("invalid error received %#+v\n", st.Details()[0])
}
if verr.Code != 99 && verr.Id != "1" && verr.Detail != "detail" {
if verr.Code != 99 || verr.Id != "1" || verr.Detail != "detail" {
t.Fatalf("invalid error received %#+v\n", verr)
}
}