Skip to content

Commit f191b45

Browse files
authored
transport/client: Return Unknown on missing or unparsable grpc-status (#8702)
See https://github.com/grpc/grpc/blob/master/doc/statuscodes.md for more details. RELEASE NOTES: * transport/client : Return Unknown on missing or unparsable grpc-status.
1 parent 112ec12 commit f191b45

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

internal/transport/http2_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
14641464
recvCompress string
14651465
httpStatusErr string
14661466
// the code from the grpc-status header, if present
1467-
grpcStatusCode = codes.Internal
1467+
grpcStatusCode = codes.Unknown
14681468
// headerError is set if an error is encountered while parsing the headers
14691469
headerError string
14701470
httpStatus string

internal/transport/transport_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2824,7 +2824,7 @@ func (s) TestClientDecodeTrailer(t *testing.T) {
28242824
{Name: ":status", Value: "xxxx"},
28252825
},
28262826
},
2827-
wantEndStreamStatus: status.New(codes.Internal, ""),
2827+
wantEndStreamStatus: status.New(codes.Unknown, ""),
28282828
},
28292829
{
28302830
name: "http2_frame_size_exceeds",
@@ -2843,7 +2843,7 @@ func (s) TestClientDecodeTrailer(t *testing.T) {
28432843
{Name: "content-type", Value: "application/grpc"},
28442844
},
28452845
},
2846-
wantEndStreamStatus: status.New(codes.Internal, ""),
2846+
wantEndStreamStatus: status.New(codes.Unknown, ""),
28472847
},
28482848
{
28492849
name: "deadline_exceeded_status",

test/http_header_end2end_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func (s) TestHTTPHeaderFrameErrorHandlingNormalTrailer(t *testing.T) {
169169
// trailer missing grpc-status
170170
":status", "502",
171171
},
172-
errCode: codes.Internal,
172+
errCode: codes.Unknown,
173173
},
174174
{
175175
name: "malformed grpc-status-details-bin field with status 404 to be ignored due to content type",

0 commit comments

Comments
 (0)