@@ -42,11 +42,11 @@ func TestRewrite(t *testing.T) {
42
42
rec = httptest .NewRecorder ()
43
43
e .ServeHTTP (rec , req )
44
44
assert .Equal (t , "/new%20users" , req .URL .EscapedPath ())
45
- req .URL .Path = "/users/jill/orders/T%2FcO4lW%2Ft%2FVp%2F"
45
+ req .URL .Path = "/users/jill/orders/T%2FcO4lW%2Ft%2FVp%2F"
46
46
rec = httptest .NewRecorder ()
47
47
e .ServeHTTP (rec , req )
48
48
assert .Equal (t , "/user/jill/order/T%2FcO4lW%2Ft%2FVp%2F" , req .URL .EscapedPath ())
49
- req .URL .Path = "/users/jill/orders/%%%%"
49
+ req .URL .Path = "/users/jill/orders/%%%%"
50
50
rec = httptest .NewRecorder ()
51
51
e .ServeHTTP (rec , req )
52
52
assert .Equal (t , http .StatusBadRequest , rec .Code )
@@ -66,14 +66,14 @@ func TestEchoRewritePreMiddleware(t *testing.T) {
66
66
67
67
// Route
68
68
r .Add (http .MethodGet , "/new" , func (c echo.Context ) error {
69
- return c .NoContent (200 )
69
+ return c .NoContent (http . StatusOK )
70
70
})
71
71
72
72
req := httptest .NewRequest (http .MethodGet , "/old" , nil )
73
73
rec := httptest .NewRecorder ()
74
74
e .ServeHTTP (rec , req )
75
75
assert .Equal (t , "/new" , req .URL .EscapedPath ())
76
- assert .Equal (t , 200 , rec .Code )
76
+ assert .Equal (t , http . StatusOK , rec .Code )
77
77
}
78
78
79
79
// Issue #1143
@@ -89,18 +89,18 @@ func TestRewriteWithConfigPreMiddleware_Issue1143(t *testing.T) {
89
89
}))
90
90
91
91
r .Add (http .MethodGet , "/api/:version/hosts/:name" , func (c echo.Context ) error {
92
- return c .String (200 , "hosts" )
92
+ return c .String (http . StatusOK , "hosts" )
93
93
})
94
94
r .Add (http .MethodGet , "/api/:version/eng" , func (c echo.Context ) error {
95
- return c .String (200 , "eng" )
95
+ return c .String (http . StatusOK , "eng" )
96
96
})
97
97
98
98
for i := 0 ; i < 100 ; i ++ {
99
99
req := httptest .NewRequest (http .MethodGet , "/api/v1/mgmt/proj/test/agt" , nil )
100
100
rec := httptest .NewRecorder ()
101
101
e .ServeHTTP (rec , req )
102
102
assert .Equal (t , "/api/v1/hosts/test" , req .URL .EscapedPath ())
103
- assert .Equal (t , 200 , rec .Code )
103
+ assert .Equal (t , http . StatusOK , rec .Code )
104
104
105
105
defer rec .Result ().Body .Close ()
106
106
bodyBytes , _ := ioutil .ReadAll (rec .Result ().Body )
0 commit comments