diff --git a/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_and_json_format.golden b/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_and_json_format.golden index 738f7ab4..b0e923c4 100644 --- a/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_and_json_format.golden +++ b/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_and_json_format.golden @@ -36,9 +36,6 @@ "header_val2" ] }, - "messages": [ - {} - ], "trailer": { "trailer_key1": [ "trailer_val1" diff --git a/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_flag.golden b/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_flag.golden index 92ae0a56..231d64f6 100644 --- a/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_flag.golden +++ b/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_flag.golden @@ -2,8 +2,6 @@ content-type: application/grpc header_key1: header_val1 header_key2: header_val2 -{} - trailer_key1: trailer_val1 trailer_key2: trailer_val2 @@ -13,3 +11,4 @@ message: "internal error" details: {"@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [{"description": "description", "field": "field"}]} {"@type": "type.googleapis.com/google.rpc.PreconditionFailure", "violations": [{"description": "description", "subject": "subject", "type": "type"}]} + diff --git a/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_flag_against_to_grpc-web_server.golden b/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_flag_against_to_grpc-web_server.golden index bee36440..55385eb7 100644 --- a/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_flag_against_to_grpc-web_server.golden +++ b/e2e/testdata/fixtures/teste2e_cli-call_failure_unary_rpc_with_--enrich_flag_against_to_grpc-web_server.golden @@ -3,8 +3,6 @@ header_key1: header_val1 header_key2: header_val2 vary: Origin -{} - trailer_key1: trailer_val1 trailer_key2: trailer_val2 @@ -14,3 +12,4 @@ message: "internal error" details: {"@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [{"description": "description", "field": "field"}]} {"@type": "type.googleapis.com/google.rpc.PreconditionFailure", "violations": [{"description": "description", "subject": "subject", "type": "type"}]} + diff --git a/e2e/testdata/fixtures/teste2e_repl-call_unaryheadertrailerfailure_by_selecting_package_and_service_with_enriched_output.golden b/e2e/testdata/fixtures/teste2e_repl-call_unaryheadertrailerfailure_by_selecting_package_and_service_with_enriched_output.golden index 5be28aeb..06a8e389 100644 --- a/e2e/testdata/fixtures/teste2e_repl-call_unaryheadertrailerfailure_by_selecting_package_and_service_with_enriched_output.golden +++ b/e2e/testdata/fixtures/teste2e_repl-call_unaryheadertrailerfailure_by_selecting_package_and_service_with_enriched_output.golden @@ -4,8 +4,6 @@ content-type: application/grpc header_key1: header_val1 header_key2: header_val2 -{} - trailer_key1: trailer_val1 trailer_key2: trailer_val2 @@ -16,3 +14,4 @@ details: {"@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [{"description": "description", "field": "field"}]} {"@type": "type.googleapis.com/google.rpc.PreconditionFailure", "violations": [{"description": "description", "subject": "subject", "type": "type"}]} + diff --git a/format/curl/curl.go b/format/curl/curl.go index 2bbf8e8a..332fc0c5 100644 --- a/format/curl/curl.go +++ b/format/curl/curl.go @@ -17,6 +17,7 @@ import ( "github.com/ktr0731/evans/present/json" "github.com/pkg/errors" _ "google.golang.org/genproto/googleapis/rpc/errdetails" // For calling RegisterType. + "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -118,6 +119,9 @@ func (p *responseFormatter) FormatStatus(status *status.Status) error { } fmt.Fprintf(p.w, "details: \n%s\n", strings.Join(details, "\n")) } + if status.Code() != codes.OK { + fmt.Fprintf(p.w, "\n") + } return nil } diff --git a/format/format.go b/format/format.go index 1127c8e8..1544b224 100644 --- a/format/format.go +++ b/format/format.go @@ -2,7 +2,6 @@ package format import ( - "github.com/golang/protobuf/ptypes/empty" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -33,7 +32,7 @@ func (f *ResponseFormatter) FormatHeader(header metadata.MD) { func (f *ResponseFormatter) FormatMessage(v interface{}) error { if v == nil { - v = &empty.Empty{} + return nil } return f.impl.FormatMessage(v) }