mirror of
https://github.com/gofiber/fiber.git
synced 2025-07-07 19:19:32 +00:00
Fix test
This commit is contained in:
parent
25100d3dbe
commit
cc1b76de48
10
app_test.go
10
app_test.go
@ -67,7 +67,7 @@ func Test_App_ErrorHandler(t *testing.T) {
|
||||
app := New()
|
||||
|
||||
app.Get("/", func(c *Ctx) {
|
||||
c.Next(errors.New("hi, I'm an error"))
|
||||
c.Next(errors.New("hi, i'm an error"))
|
||||
})
|
||||
|
||||
resp, err := app.Test(httptest.NewRequest("GET", "/", nil))
|
||||
@ -76,19 +76,19 @@ func Test_App_ErrorHandler(t *testing.T) {
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
utils.AssertEqual(t, "hi, I'm an error!", string(body))
|
||||
utils.AssertEqual(t, "hi, i'm an error", string(body))
|
||||
|
||||
}
|
||||
|
||||
func Test_App_ErrorHandler_Custom(t *testing.T) {
|
||||
app := New(&Settings{
|
||||
ErrorHandler: func(ctx *Ctx, err error) {
|
||||
ctx.Status(200).SendString("Hi, I'm an custom error!")
|
||||
ctx.Status(200).SendString("hi, i'm an custom error")
|
||||
},
|
||||
})
|
||||
|
||||
app.Get("/", func(c *Ctx) {
|
||||
c.Next(errors.New("hi, I'm an error"))
|
||||
c.Next(errors.New("hi, i'm an error"))
|
||||
})
|
||||
|
||||
resp, err := app.Test(httptest.NewRequest("GET", "/", nil))
|
||||
@ -97,7 +97,7 @@ func Test_App_ErrorHandler_Custom(t *testing.T) {
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
utils.AssertEqual(t, "hi, I'm an custom error!", string(body))
|
||||
utils.AssertEqual(t, "hi, i'm an custom error", string(body))
|
||||
}
|
||||
|
||||
func Test_App_Nested_Params(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user