Skip to content

Commit

Permalink
Handle ctx err in writeheader
Browse files Browse the repository at this point in the history
  • Loading branch information
idiamond-stripe committed Apr 4, 2022
1 parent 0066bf6 commit 4811f7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/transport/http2_server.go
Expand Up @@ -1065,6 +1065,9 @@ func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) e
if _, ok := err.(ConnectionError); ok {
return err
}
if s.ctx.Err() != nil {
return ContextErr(s.ctx.Err())
}
// TODO(mmukhi, dfawley): Make sure this is the right code to return.
return status.Errorf(codes.Internal, "transport: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion test/end2end_test.go
Expand Up @@ -4964,7 +4964,7 @@ func testClientSendDataAfterCloseSend(t *testing.T, e env) {
}
if err := stream.SendMsg(nil); err == nil {
t.Error("expected error sending message on stream after stream closed due to illegal data")
} else if status.Code(err) != codes.Internal {
} else if status.Code(err) != codes.Canceled {
t.Errorf("expected internal error, instead received '%v'", err)
}
return nil
Expand Down

0 comments on commit 4811f7a

Please sign in to comment.