2020-02-10 19:35:19 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/kataras/iris/v12/httptest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewConditionalHandler(t *testing.T) {
|
|
|
|
app := newApp()
|
|
|
|
e := httptest.New(t, app)
|
|
|
|
|
|
|
|
e.GET("/api/v1/users").Expect().Status(httptest.StatusOK).
|
2023-07-08 01:08:18 +02:00
|
|
|
Body().IsEqual("requested: <b>/api/v1/users</b>")
|
2020-02-10 19:35:19 +01:00
|
|
|
e.GET("/api/v1/users").WithQuery("admin", "true").Expect().Status(httptest.StatusOK).
|
2023-07-08 01:08:18 +02:00
|
|
|
Body().IsEqual("<title>Admin</title>\n<h1>Hello Admin</h1><br>requested: <b>/api/v1/users</b>")
|
2020-02-10 19:35:19 +01:00
|
|
|
}
|