1
0
mirror of https://github.com/labstack/echo.git synced 2025-12-05 23:08:17 +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 TestCORS(t *testing.T) {
e := echo.New()
rq := test.NewRequest(echo.GET, "/", nil)
rc := test.NewResponseRecorder()
c := echo.NewContext(rq, rc, e)
c := e.NewContext(rq, rc)
cors := CORSWithConfig(CORSConfig{
AllowCredentials: true,
})
@@ -28,7 +28,7 @@ func TestCORS(t *testing.T) {
// Wildcard origin
rq = test.NewRequest(echo.GET, "/", nil)
rc = test.NewResponseRecorder()
c = echo.NewContext(rq, rc, e)
c = e.NewContext(rq, rc)
rq.Header().Set(echo.HeaderOrigin, "localhost")
h(c)
assert.Equal(t, "*", rc.Header().Get(echo.HeaderAccessControlAllowOrigin))
@@ -36,7 +36,7 @@ func TestCORS(t *testing.T) {
// Simple request
rq = test.NewRequest(echo.GET, "/", nil)
rc = test.NewResponseRecorder()
c = echo.NewContext(rq, rc, e)
c = e.NewContext(rq, rc)
rq.Header().Set(echo.HeaderOrigin, "localhost")
cors = CORSWithConfig(CORSConfig{
AllowOrigins: []string{"localhost"},
@@ -52,7 +52,7 @@ func TestCORS(t *testing.T) {
// Preflight request
rq = test.NewRequest(echo.OPTIONS, "/", nil)
rc = test.NewResponseRecorder()
c = echo.NewContext(rq, rc, e)
c = e.NewContext(rq, rc)
rq.Header().Set(echo.HeaderOrigin, "localhost")
rq.Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSON)
h(c)