Skip to content

Commit b3e21d8

Browse files
mbissaeaswars
authored andcommitted
transport/client: Return Unknown on missing or unparsable grpc-status (grpc#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 cadae08 commit b3e21d8

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
@@ -2794,7 +2794,7 @@ func (s) TestClientDecodeTrailer(t *testing.T) {
27942794
{Name: ":status", Value: "xxxx"},
27952795
},
27962796
},
2797-
wantEndStreamStatus: status.New(codes.Internal, ""),
2797+
wantEndStreamStatus: status.New(codes.Unknown, ""),
27982798
},
27992799
{
28002800
name: "http2_frame_size_exceeds",
@@ -2813,7 +2813,7 @@ func (s) TestClientDecodeTrailer(t *testing.T) {
28132813
{Name: "content-type", Value: "application/grpc"},
28142814
},
28152815
},
2816-
wantEndStreamStatus: status.New(codes.Internal, ""),
2816+
wantEndStreamStatus: status.New(codes.Unknown, ""),
28172817
},
28182818
{
28192819
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)