@@ -83,8 +83,8 @@ func TestClient(t *testing.T) {
83
83
}
84
84
}
85
85
86
- func TestClientHead_h1 (t * testing.T ) { testClientHead (t , false ) }
87
- func TestClientHead_h2 (t * testing.T ) { testClientHead (t , true ) }
86
+ func TestClientHead_h1 (t * testing.T ) { testClientHead (t , h1Mode ) }
87
+ func TestClientHead_h2 (t * testing.T ) { testClientHead (t , h2Mode ) }
88
88
89
89
func testClientHead (t * testing.T , h2 bool ) {
90
90
defer afterTest (t )
@@ -496,8 +496,8 @@ func (j *RecordingJar) logf(format string, args ...interface{}) {
496
496
fmt .Fprintf (& j .log , format , args ... )
497
497
}
498
498
499
- func TestStreamingGet_h1 (t * testing.T ) { testStreamingGet (t , false ) }
500
- func TestStreamingGet_h2 (t * testing.T ) { testStreamingGet (t , true ) }
499
+ func TestStreamingGet_h1 (t * testing.T ) { testStreamingGet (t , h1Mode ) }
500
+ func TestStreamingGet_h2 (t * testing.T ) { testStreamingGet (t , h2Mode ) }
501
501
502
502
func testStreamingGet (t * testing.T , h2 bool ) {
503
503
defer afterTest (t )
@@ -772,11 +772,11 @@ func TestHTTPSClientDetectsHTTPServer(t *testing.T) {
772
772
773
773
// Verify Response.ContentLength is populated. https://golang.org/issue/4126
774
774
func TestClientHeadContentLength_h1 (t * testing.T ) {
775
- testClientHeadContentLength (t , false )
775
+ testClientHeadContentLength (t , h1Mode )
776
776
}
777
777
778
778
func TestClientHeadContentLength_h2 (t * testing.T ) {
779
- testClientHeadContentLength (t , true )
779
+ testClientHeadContentLength (t , h2Mode )
780
780
}
781
781
782
782
func testClientHeadContentLength (t * testing.T , h2 bool ) {
@@ -1037,14 +1037,8 @@ func TestClientTimeout_Headers(t *testing.T) {
1037
1037
}
1038
1038
}
1039
1039
1040
- func TestClientRedirectEatsBody_h1 (t * testing.T ) {
1041
- testClientRedirectEatsBody (t , false )
1042
- }
1043
-
1044
- func TestClientRedirectEatsBody_h2 (t * testing.T ) {
1045
- testClientRedirectEatsBody (t , true )
1046
- }
1047
-
1040
+ func TestClientRedirectEatsBody_h1 (t * testing.T ) { testClientRedirectEatsBody (t , h1Mode ) }
1041
+ func TestClientRedirectEatsBody_h2 (t * testing.T ) { testClientRedirectEatsBody (t , h2Mode ) }
1048
1042
func testClientRedirectEatsBody (t * testing.T , h2 bool ) {
1049
1043
defer afterTest (t )
1050
1044
saw := make (chan string , 2 )
@@ -1093,9 +1087,14 @@ func (f eofReaderFunc) Read(p []byte) (n int, err error) {
1093
1087
return 0 , io .EOF
1094
1088
}
1095
1089
1096
- func TestClientTrailers (t * testing.T ) {
1090
+ func TestClientTrailers_h1 (t * testing.T ) { testClientTrailers (t , h1Mode ) }
1091
+ func TestClientTrailers_h2 (t * testing.T ) {
1092
+ t .Skip ("skipping in http2 mode; golang.org/issue/13557" )
1093
+ testClientTrailers (t , h2Mode )
1094
+ }
1095
+ func testClientTrailers (t * testing.T , h2 bool ) {
1097
1096
defer afterTest (t )
1098
- ts := httptest . NewServer ( HandlerFunc (func (w ResponseWriter , r * Request ) {
1097
+ cst := newClientServerTest ( t , h2 , HandlerFunc (func (w ResponseWriter , r * Request ) {
1099
1098
w .Header ().Set ("Connection" , "close" )
1100
1099
w .Header ().Set ("Trailer" , "Server-Trailer-A, Server-Trailer-B" )
1101
1100
w .Header ().Add ("Trailer" , "Server-Trailer-C" )
@@ -1129,10 +1128,10 @@ func TestClientTrailers(t *testing.T) {
1129
1128
w .Header ().Set ("Server-Trailer-A" , "valuea" )
1130
1129
w .Header ().Set ("Server-Trailer-C" , "valuec" ) // skipping B
1131
1130
}))
1132
- defer ts . Close ()
1131
+ defer cst . close ()
1133
1132
1134
1133
var req * Request
1135
- req , _ = NewRequest ("POST" , ts .URL , io .MultiReader (
1134
+ req , _ = NewRequest ("POST" , cst . ts .URL , io .MultiReader (
1136
1135
eofReaderFunc (func () {
1137
1136
req .Trailer ["Client-Trailer-A" ] = []string {"valuea" }
1138
1137
}),
@@ -1146,7 +1145,7 @@ func TestClientTrailers(t *testing.T) {
1146
1145
"Client-Trailer-B" : nil , // to be set later
1147
1146
}
1148
1147
req .ContentLength = - 1
1149
- res , err := DefaultClient .Do (req )
1148
+ res , err := cst . c .Do (req )
1150
1149
if err != nil {
1151
1150
t .Fatal (err )
1152
1151
}
0 commit comments