mirror of
https://github.com/labstack/echo.git
synced 2025-06-06 23:46:16 +02:00
change the hardcode for http constant
This commit is contained in:
parent
28ec3f7bdb
commit
5c5c83d290
@ -66,14 +66,14 @@ func TestEchoRewritePreMiddleware(t *testing.T) {
|
||||
|
||||
// Route
|
||||
r.Add(http.MethodGet, "/new", func(c echo.Context) error {
|
||||
return c.NoContent(200)
|
||||
return c.NoContent(http.StatusOK)
|
||||
})
|
||||
|
||||
req := httptest.NewRequest(http.MethodGet, "/old", nil)
|
||||
rec := httptest.NewRecorder()
|
||||
e.ServeHTTP(rec, req)
|
||||
assert.Equal(t, "/new", req.URL.EscapedPath())
|
||||
assert.Equal(t, 200, rec.Code)
|
||||
assert.Equal(t, http.StatusOK, rec.Code)
|
||||
}
|
||||
|
||||
// Issue #1143
|
||||
@ -89,10 +89,10 @@ func TestRewriteWithConfigPreMiddleware_Issue1143(t *testing.T) {
|
||||
}))
|
||||
|
||||
r.Add(http.MethodGet, "/api/:version/hosts/:name", func(c echo.Context) error {
|
||||
return c.String(200, "hosts")
|
||||
return c.String(http.StatusOK, "hosts")
|
||||
})
|
||||
r.Add(http.MethodGet, "/api/:version/eng", func(c echo.Context) error {
|
||||
return c.String(200, "eng")
|
||||
return c.String(http.StatusOK, "eng")
|
||||
})
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
@ -100,7 +100,7 @@ func TestRewriteWithConfigPreMiddleware_Issue1143(t *testing.T) {
|
||||
rec := httptest.NewRecorder()
|
||||
e.ServeHTTP(rec, req)
|
||||
assert.Equal(t, "/api/v1/hosts/test", req.URL.EscapedPath())
|
||||
assert.Equal(t, 200, rec.Code)
|
||||
assert.Equal(t, http.StatusOK, rec.Code)
|
||||
|
||||
defer rec.Result().Body.Close()
|
||||
bodyBytes, _ := ioutil.ReadAll(rec.Result().Body)
|
||||
|
Loading…
x
Reference in New Issue
Block a user