mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 19:07:06 +00:00
Read https://github.com/kataras/iris/tree/master/HISTORY.md
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"github.com/gavv/httpexpect"
|
||||
"github.com/gavv/httpexpect/fasthttpexpect"
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/config"
|
||||
)
|
||||
|
||||
var notFoundMessage = "Iris custom message for 404 not found"
|
||||
@@ -46,15 +45,7 @@ func TestCustomErrors(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
api.PreListen(config.Server{ListeningAddr: ""})
|
||||
|
||||
// create httpexpect instance that will call fasthtpp.RequestHandler directly
|
||||
e := httpexpect.WithConfig(httpexpect.Config{
|
||||
Reporter: httpexpect.NewAssertReporter(t),
|
||||
Client: fasthttpexpect.NewBinder(api.ServeRequest),
|
||||
})
|
||||
// first register the custom errors
|
||||
|
||||
// register the custom errors
|
||||
api.OnError(404, func(ctx *iris.Context) {
|
||||
ctx.Write("%s", notFoundMessage)
|
||||
})
|
||||
@@ -63,6 +54,12 @@ func TestCustomErrors(t *testing.T) {
|
||||
ctx.Write("%s", internalServerMessage)
|
||||
})
|
||||
|
||||
// create httpexpect instance that will call fasthtpp.RequestHandler directly
|
||||
e := httpexpect.WithConfig(httpexpect.Config{
|
||||
Reporter: httpexpect.NewAssertReporter(t),
|
||||
Client: fasthttpexpect.NewBinder(api.NoListen().Handler),
|
||||
})
|
||||
|
||||
// run the tests
|
||||
for _, r := range routesCustomErrors {
|
||||
e.Request(r.Method, r.RequestPath).
|
||||
|
||||
Reference in New Issue
Block a user