@@ -72,18 +72,18 @@ func newTLSServer(t *testing.T) *cstServer {
72
72
func (t cstHandler ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
73
73
if r .URL .Path != cstPath {
74
74
t .Logf ("path=%v, want %v" , r .URL .Path , cstPath )
75
- http .Error (w , "bad path" , 400 )
75
+ http .Error (w , "bad path" , http . StatusBadRequest )
76
76
return
77
77
}
78
78
if r .URL .RawQuery != cstRawQuery {
79
79
t .Logf ("query=%v, want %v" , r .URL .RawQuery , cstRawQuery )
80
- http .Error (w , "bad path" , 400 )
80
+ http .Error (w , "bad path" , http . StatusBadRequest )
81
81
return
82
82
}
83
83
subprotos := Subprotocols (r )
84
84
if ! reflect .DeepEqual (subprotos , cstDialer .Subprotocols ) {
85
85
t .Logf ("subprotols=%v, want %v" , subprotos , cstDialer .Subprotocols )
86
- http .Error (w , "bad protocol" , 400 )
86
+ http .Error (w , "bad protocol" , http . StatusBadRequest )
87
87
return
88
88
}
89
89
ws , err := cstUpgrader .Upgrade (w , r , http.Header {"Set-Cookie" : {"sessionID=1234" }})
@@ -160,13 +160,13 @@ func TestProxyDial(t *testing.T) {
160
160
func (w http.ResponseWriter , r * http.Request ) {
161
161
if r .Method == "CONNECT" {
162
162
connect = true
163
- w .WriteHeader (200 )
163
+ w .WriteHeader (http . StatusOK )
164
164
return
165
165
}
166
166
167
167
if ! connect {
168
168
t .Log ("connect not received" )
169
- http .Error (w , "connect not received" , 405 )
169
+ http .Error (w , "connect not received" , http . StatusMethodNotAllowed )
170
170
return
171
171
}
172
172
origHandler .ServeHTTP (w , r )
@@ -200,13 +200,13 @@ func TestProxyAuthorizationDial(t *testing.T) {
200
200
expectedProxyAuth := "Basic " + base64 .StdEncoding .EncodeToString ([]byte ("username:password" ))
201
201
if r .Method == "CONNECT" && proxyAuth == expectedProxyAuth {
202
202
connect = true
203
- w .WriteHeader (200 )
203
+ w .WriteHeader (http . StatusOK )
204
204
return
205
205
}
206
206
207
207
if ! connect {
208
208
t .Log ("connect with proxy authorization not received" )
209
- http .Error (w , "connect with proxy authorization not received" , 405 )
209
+ http .Error (w , "connect with proxy authorization not received" , http . StatusMethodNotAllowed )
210
210
return
211
211
}
212
212
origHandler .ServeHTTP (w , r )
0 commit comments