1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-19 19:07:06 +00:00

implement the makeHandler and structure the high-level mvc's API

Former-commit-id: 412118eae436981711ef57821f2d85b77a5d1a12
This commit is contained in:
kataras
2017-11-24 12:32:35 +02:00
parent 3a46102d4d
commit bfec1d174f
5 changed files with 160 additions and 3 deletions

30
mvc2/mvc_test.go Normal file
View File

@@ -0,0 +1,30 @@
package mvc2_test
import (
"testing"
"github.com/kataras/iris"
"github.com/kataras/iris/httptest"
"github.com/kataras/iris/mvc2"
)
var (
lowLevelHandler = func(ctx iris.Context) {
ctx.Writef("low-level handler")
}
)
func TestHandler(t *testing.T) {
app := iris.New()
m := mvc2.New()
// should just return a context.Handler
// without performance penalties.
app.Get("/", m.Handler(lowLevelHandler))
e := httptest.New(t, app, httptest.LogLevel("debug"))
// 1
e.GET("/").Expect().Status(httptest.StatusOK).
Body().Equal("low-level handler")
}