@@ -6085,14 +6085,14 @@ func TestTransportClosesBodyOnInvalidRequests(t *testing.T) {
6085
6085
Method : " " ,
6086
6086
URL : u ,
6087
6087
},
6088
- wantErr : " invalid method" ,
6088
+ wantErr : ` invalid method " "` ,
6089
6089
},
6090
6090
{
6091
6091
name : "nil URL" ,
6092
6092
req : & Request {
6093
6093
Method : "GET" ,
6094
6094
},
6095
- wantErr : " nil Request.URL" ,
6095
+ wantErr : ` nil Request.URL` ,
6096
6096
},
6097
6097
{
6098
6098
name : "invalid header key" ,
@@ -6101,7 +6101,7 @@ func TestTransportClosesBodyOnInvalidRequests(t *testing.T) {
6101
6101
Header : Header {"💡" : {"emoji" }},
6102
6102
URL : u ,
6103
6103
},
6104
- wantErr : " invalid header field name" ,
6104
+ wantErr : ` invalid header field name "💡"` ,
6105
6105
},
6106
6106
{
6107
6107
name : "invalid header value" ,
@@ -6110,23 +6110,23 @@ func TestTransportClosesBodyOnInvalidRequests(t *testing.T) {
6110
6110
Header : Header {"key" : {"\x19 " }},
6111
6111
URL : u ,
6112
6112
},
6113
- wantErr : " invalid header field value" ,
6113
+ wantErr : ` invalid header field value for "key"` ,
6114
6114
},
6115
6115
{
6116
6116
name : "non HTTP(s) scheme" ,
6117
6117
req : & Request {
6118
6118
Method : "POST" ,
6119
6119
URL : & url.URL {Scheme : "faux" },
6120
6120
},
6121
- wantErr : " unsupported protocol scheme" ,
6121
+ wantErr : ` unsupported protocol scheme "faux"` ,
6122
6122
},
6123
6123
{
6124
6124
name : "no Host in URL" ,
6125
6125
req : & Request {
6126
6126
Method : "POST" ,
6127
6127
URL : & url.URL {Scheme : "http" },
6128
6128
},
6129
- wantErr : " no Host" ,
6129
+ wantErr : ` no Host in request URL` ,
6130
6130
},
6131
6131
}
6132
6132
@@ -6142,8 +6142,8 @@ func TestTransportClosesBodyOnInvalidRequests(t *testing.T) {
6142
6142
if ! bc {
6143
6143
t .Fatal ("Expected body to have been closed" )
6144
6144
}
6145
- if g , w := err .Error (), tt .wantErr ; ! strings .Contains (g , w ) {
6146
- t .Fatalf ("Error mismatch\n \t %q \n does not contain \n \t %q" , g , w )
6145
+ if g , w := err .Error (), tt .wantErr ; ! strings .HasSuffix (g , w ) {
6146
+ t .Fatalf ("Error mismatch: %q does not end with %q" , g , w )
6147
6147
}
6148
6148
})
6149
6149
}
0 commit comments