Skip to content

Commit ea7b66e

Browse files
easwarsmbissa
andauthored
Cherrypick #8702 to v1.77.x (#8709)
#8548 changed the grpc status code returned on missing grpc-status header to Internal. This PR changes it back to Unknown as that is the expected behavior. See [grpc/grpc@master/doc/statuscodes.md](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md) for more details. Here Unknown is defined as follows: ``` Unknown error. For example, this error may be returned when a Status value received from another address space belongs to an error space that is not known in this address space. Also errors raised by APIs that do not return enough error information may be converted to this error. ``` RELEASE NOTES: - transport/client : Return status code Unknown on missing grpc-status. Co-authored-by: Madhav Bissa <[email protected]>
1 parent cadae08 commit ea7b66e

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)