@@ -2631,7 +2631,8 @@ func (s) TestClientDecodeHeaderStatusErr(t *testing.T) {
2631
2631
},
2632
2632
},
2633
2633
// no error
2634
- wantStatus : status .New (codes .OK , "" ),
2634
+ wantStatus : status .New (codes .OK , "" ),
2635
+ wantStatusEndStream : status .New (codes .OK , "" ),
2635
2636
},
2636
2637
{
2637
2638
name : "missing content-type header" ,
@@ -2645,6 +2646,10 @@ func (s) TestClientDecodeHeaderStatusErr(t *testing.T) {
2645
2646
codes .Unknown ,
2646
2647
"malformed header: missing HTTP content-type" ,
2647
2648
),
2649
+ wantStatusEndStream : status .New (
2650
+ codes .Unknown ,
2651
+ "malformed header: missing HTTP content-type" ,
2652
+ ),
2648
2653
},
2649
2654
{
2650
2655
name : "invalid grpc status header field" ,
@@ -2659,6 +2664,10 @@ func (s) TestClientDecodeHeaderStatusErr(t *testing.T) {
2659
2664
codes .Internal ,
2660
2665
"transport: malformed grpc-status: strconv.ParseInt: parsing \" xxxx\" : invalid syntax" ,
2661
2666
),
2667
+ wantStatusEndStream : status .New (
2668
+ codes .Internal ,
2669
+ "transport: malformed grpc-status: strconv.ParseInt: parsing \" xxxx\" : invalid syntax" ,
2670
+ ),
2662
2671
},
2663
2672
{
2664
2673
name : "invalid http content type" ,
@@ -2671,6 +2680,10 @@ func (s) TestClientDecodeHeaderStatusErr(t *testing.T) {
2671
2680
codes .Internal ,
2672
2681
"malformed header: missing HTTP status; transport: received unexpected content-type \" application/json\" " ,
2673
2682
),
2683
+ wantStatusEndStream : status .New (
2684
+ codes .Internal ,
2685
+ "malformed header: missing HTTP status; transport: received unexpected content-type \" application/json\" " ,
2686
+ ),
2674
2687
},
2675
2688
{
2676
2689
name : "http fallback and invalid http status" ,
@@ -2684,6 +2697,10 @@ func (s) TestClientDecodeHeaderStatusErr(t *testing.T) {
2684
2697
codes .Internal ,
2685
2698
"transport: malformed http-status: strconv.ParseInt: parsing \" xxxx\" : invalid syntax" ,
2686
2699
),
2700
+ wantStatusEndStream : status .New (
2701
+ codes .Internal ,
2702
+ "transport: malformed http-status: strconv.ParseInt: parsing \" xxxx\" : invalid syntax" ,
2703
+ ),
2687
2704
},
2688
2705
{
2689
2706
name : "http2 frame size exceeds" ,
@@ -2695,6 +2712,10 @@ func (s) TestClientDecodeHeaderStatusErr(t *testing.T) {
2695
2712
codes .Internal ,
2696
2713
"peer header list size exceeded limit" ,
2697
2714
),
2715
+ wantStatusEndStream : status .New (
2716
+ codes .Internal ,
2717
+ "peer header list size exceeded limit" ,
2718
+ ),
2698
2719
},
2699
2720
{
2700
2721
name : "ignoring bad http status in grpc mode" ,
@@ -2705,7 +2726,8 @@ func (s) TestClientDecodeHeaderStatusErr(t *testing.T) {
2705
2726
{Name : ":status" , Value : "504" },
2706
2727
},
2707
2728
},
2708
- wantStatus : status .New (codes .OK , "" ),
2729
+ wantStatus : status .New (codes .OK , "" ),
2730
+ wantStatusEndStream : status .New (codes .OK , "" ),
2709
2731
},
2710
2732
{
2711
2733
name : "missing http status and grpc status" ,
@@ -2729,7 +2751,7 @@ func (s) TestClientDecodeHeaderStatusErr(t *testing.T) {
2729
2751
wantStatusEndStream : status .New (codes .Internal , "" ),
2730
2752
},
2731
2753
{
2732
- name : "trailer only grpc timeout ignores http status" ,
2754
+ name : "ignore valid http status for grpc " ,
2733
2755
metaHeaderFrame : & http2.MetaHeadersFrame {
2734
2756
Fields : []hpack.HeaderField {
2735
2757
{Name : "content-type" , Value : "application/grpc" },
@@ -2738,14 +2760,25 @@ func (s) TestClientDecodeHeaderStatusErr(t *testing.T) {
2738
2760
{Name : ":status" , Value : "200" },
2739
2761
},
2740
2762
},
2763
+ wantStatus : status .New (codes .OK , "" ),
2764
+ wantStatusEndStream : status .New (codes .DeadlineExceeded , "Request timed out: Internal error" ),
2765
+ },
2766
+ {
2767
+ name : "ignore illegal http status for grpc" ,
2768
+ metaHeaderFrame : & http2.MetaHeadersFrame {
2769
+ Fields : []hpack.HeaderField {
2770
+ {Name : "content-type" , Value : "application/grpc" },
2771
+ {Name : "grpc-status" , Value : "4" },
2772
+ {Name : "grpc-message" , Value : "Request timed out: Internal error" },
2773
+ {Name : ":status" , Value : "thisIsIllegal" },
2774
+ },
2775
+ },
2776
+ wantStatus : status .New (codes .OK , "" ),
2741
2777
wantStatusEndStream : status .New (codes .DeadlineExceeded , "Request timed out: Internal error" ),
2742
2778
},
2743
2779
} {
2744
2780
2745
2781
t .Run (test .name , func (t * testing.T ) {
2746
- if test .wantStatus == nil {
2747
- t .Skip ()
2748
- }
2749
2782
ts := testStream ()
2750
2783
s := testClient (ts )
2751
2784
0 commit comments