@@ -72,18 +72,18 @@ func newTLSServer(t *testing.T) *cstServer {
7272func (t cstHandler ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
7373 if r .URL .Path != cstPath {
7474 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 )
7676 return
7777 }
7878 if r .URL .RawQuery != cstRawQuery {
7979 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 )
8181 return
8282 }
8383 subprotos := Subprotocols (r )
8484 if ! reflect .DeepEqual (subprotos , cstDialer .Subprotocols ) {
8585 t .Logf ("subprotols=%v, want %v" , subprotos , cstDialer .Subprotocols )
86- http .Error (w , "bad protocol" , 400 )
86+ http .Error (w , "bad protocol" , http . StatusBadRequest )
8787 return
8888 }
8989 ws , err := cstUpgrader .Upgrade (w , r , http.Header {"Set-Cookie" : {"sessionID=1234" }})
@@ -160,13 +160,13 @@ func TestProxyDial(t *testing.T) {
160160 func (w http.ResponseWriter , r * http.Request ) {
161161 if r .Method == "CONNECT" {
162162 connect = true
163- w .WriteHeader (200 )
163+ w .WriteHeader (http . StatusOK )
164164 return
165165 }
166166
167167 if ! connect {
168168 t .Log ("connect not received" )
169- http .Error (w , "connect not received" , 405 )
169+ http .Error (w , "connect not received" , http . StatusMethodNotAllowed )
170170 return
171171 }
172172 origHandler .ServeHTTP (w , r )
@@ -200,13 +200,13 @@ func TestProxyAuthorizationDial(t *testing.T) {
200200 expectedProxyAuth := "Basic " + base64 .StdEncoding .EncodeToString ([]byte ("username:password" ))
201201 if r .Method == "CONNECT" && proxyAuth == expectedProxyAuth {
202202 connect = true
203- w .WriteHeader (200 )
203+ w .WriteHeader (http . StatusOK )
204204 return
205205 }
206206
207207 if ! connect {
208208 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 )
210210 return
211211 }
212212 origHandler .ServeHTTP (w , r )
0 commit comments