iris/_examples/routing/conditional-chain/main_test.go
Gerasimos (Makis) Maropoulos c558e039d5 fix #1446
Former-commit-id: 6ac95ef58bf3dd0dac8bed2100495fa9908f41d4
2020-02-10 20:35:19 +02:00

18 lines
465 B
Go

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).
Body().Equal("requested: <b>/api/v1/users</b>")
e.GET("/api/v1/users").WithQuery("admin", "true").Expect().Status(httptest.StatusOK).
Body().Equal("<title>Admin</title>\n<h1>Hello Admin</h1><br>requested: <b>/api/v1/users</b>")
}