-
Notifications
You must be signed in to change notification settings - Fork 4.6k
client: ignore http status header for gRPC streams #8548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
50b5337
b1a7265
b4cce55
7087664
aceb8be
734cd4d
bebc8d3
09cf708
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,10 +103,9 @@ func (s) TestHTTPHeaderFrameErrorHandlingInitialHeader(t *testing.T) { | |
| errCode codes.Code | ||
| }{ | ||
| { | ||
| name: "missing gRPC status", | ||
| name: "missing gRPC content type", | ||
arjan-bal marked this conversation as resolved.
Show resolved
Hide resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like you have changed this test instead of adding a new one? Shouldn't we still have a test that sets these exact header fields?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing grpc status is no longer relevant in the the initial headers - it is tested in the trailers test where grpc status is expected/mandatory. |
||
| header: []string{ | ||
| ":status", "403", | ||
| "content-type", "application/grpc", | ||
| }, | ||
| errCode: codes.PermissionDenied, | ||
| }, | ||
|
|
@@ -120,23 +119,23 @@ func (s) TestHTTPHeaderFrameErrorHandlingInitialHeader(t *testing.T) { | |
| errCode: codes.Internal, | ||
| }, | ||
| { | ||
| name: "Malformed grpc-tags-bin field", | ||
| name: "Malformed grpc-tags-bin field ignores http status", | ||
| header: []string{ | ||
| ":status", "502", | ||
| "content-type", "application/grpc", | ||
| "grpc-status", "0", | ||
| "grpc-tags-bin", "???", | ||
| }, | ||
| errCode: codes.Unavailable, | ||
| errCode: codes.Internal, | ||
| }, | ||
| { | ||
| name: "gRPC status error", | ||
| name: "gRPC status error ignoring http status", | ||
| header: []string{ | ||
| ":status", "502", | ||
| "content-type", "application/grpc", | ||
| "grpc-status", "3", | ||
| }, | ||
| errCode: codes.Unavailable, | ||
| errCode: codes.InvalidArgument, | ||
| }, | ||
| } { | ||
| t.Run(test.name, func(t *testing.T) { | ||
|
|
@@ -161,7 +160,7 @@ func (s) TestHTTPHeaderFrameErrorHandlingNormalTrailer(t *testing.T) { | |
| errCode codes.Code | ||
| }{ | ||
| { | ||
| name: "trailer missing grpc-status", | ||
| name: "trailer missing grpc-status to ignore http status", | ||
| responseHeader: []string{ | ||
| ":status", "200", | ||
| "content-type", "application/grpc", | ||
|
|
@@ -170,10 +169,10 @@ func (s) TestHTTPHeaderFrameErrorHandlingNormalTrailer(t *testing.T) { | |
| // trailer missing grpc-status | ||
| ":status", "502", | ||
| }, | ||
| errCode: codes.Unavailable, | ||
| errCode: codes.Internal, | ||
| }, | ||
| { | ||
| name: "malformed grpc-status-details-bin field with status 404", | ||
| name: "malformed grpc-status-details-bin field with status 404 to be ignored due to content type", | ||
| responseHeader: []string{ | ||
| ":status", "404", | ||
| "content-type", "application/grpc", | ||
|
|
@@ -183,20 +182,19 @@ func (s) TestHTTPHeaderFrameErrorHandlingNormalTrailer(t *testing.T) { | |
| "grpc-status", "0", | ||
| "grpc-status-details-bin", "????", | ||
| }, | ||
| errCode: codes.Unimplemented, | ||
| errCode: codes.Internal, | ||
| }, | ||
| { | ||
| name: "malformed grpc-status-details-bin field with status 200", | ||
| name: "malformed grpc-status-details-bin field with status 404 and no content type", | ||
arjan-bal marked this conversation as resolved.
Show resolved
Hide resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar - don't we still want to have a test with an illegal grpc-status-details-bin and status 200? We can also have this new test case, but it seems like having more test cases is always better.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the content type is application/grpc (as was in previous version of the test) the http status is immaterial (200/404 etc won't make a difference) and it is tested in the test case above this with 404. This was more important variation of data where we check without correct content type. |
||
| responseHeader: []string{ | ||
| ":status", "200", | ||
| "content-type", "application/grpc", | ||
| ":status", "404", | ||
| }, | ||
| trailer: []string{ | ||
| // malformed grpc-status-details-bin field | ||
| "grpc-status", "0", | ||
| "grpc-status-details-bin", "????", | ||
| }, | ||
| errCode: codes.Internal, | ||
| errCode: codes.Unimplemented, | ||
| }, | ||
| } | ||
| for _, test := range tests { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.