1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-29 22:48:07 +02:00

Fixed middleware test cases

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2016-04-16 16:02:22 -07:00
parent 467cf05b41
commit ce80fc8ea4
6 changed files with 35 additions and 35 deletions

View File

@@ -13,7 +13,7 @@ func TestAddTrailingSlash(t *testing.T) {
e := echo.New()
rq := test.NewRequest(echo.GET, "/add-slash", nil)
rc := test.NewResponseRecorder()
c := echo.NewContext(rq, rc, e)
c := e.NewContext(rq, rc)
h := AddTrailingSlash()(func(c echo.Context) error {
return nil
})
@@ -24,7 +24,7 @@ func TestAddTrailingSlash(t *testing.T) {
// With config
rq = test.NewRequest(echo.GET, "/add-slash?key=value", nil)
rc = test.NewResponseRecorder()
c = echo.NewContext(rq, rc, e)
c = e.NewContext(rq, rc)
h = AddTrailingSlashWithConfig(TrailingSlashConfig{
RedirectCode: http.StatusMovedPermanently,
})(func(c echo.Context) error {
@@ -39,7 +39,7 @@ func TestRemoveTrailingSlash(t *testing.T) {
e := echo.New()
rq := test.NewRequest(echo.GET, "/remove-slash/", nil)
rc := test.NewResponseRecorder()
c := echo.NewContext(rq, rc, e)
c := e.NewContext(rq, rc)
h := RemoveTrailingSlash()(func(c echo.Context) error {
return nil
})
@@ -50,7 +50,7 @@ func TestRemoveTrailingSlash(t *testing.T) {
// With config
rq = test.NewRequest(echo.GET, "/remove-slash/?key=value", nil)
rc = test.NewResponseRecorder()
c = echo.NewContext(rq, rc, e)
c = e.NewContext(rq, rc)
h = RemoveTrailingSlashWithConfig(TrailingSlashConfig{
RedirectCode: http.StatusMovedPermanently,
})(func(c echo.Context) error {