1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00
Former-commit-id: fe6305deed00e170bf4d39a12c0644fe686e0a24
This commit is contained in:
Gerasimos (Makis) Maropoulos
2018-10-21 19:20:05 +03:00
parent dbba631df4
commit 3962710d3d
109 changed files with 4383 additions and 2658 deletions

View File

@@ -37,6 +37,7 @@ type testControllerHandle struct {
func (c *testControllerHandle) BeforeActivation(b BeforeActivation) {
b.Handle("GET", "/histatic", "HiStatic")
b.Handle("GET", "/hiservice", "HiService")
b.Handle("GET", "/hiservice/{ps:string}", "HiServiceBy")
b.Handle("GET", "/hiparam/{ps:string}", "HiParamBy")
b.Handle("GET", "/hiparamempyinput/{ps:string}", "HiParamEmptyInputBy")
}
@@ -84,6 +85,10 @@ func (c *testControllerHandle) HiService() string {
return c.Service.Say("hi")
}
func (c *testControllerHandle) HiServiceBy(v string) string {
return c.Service.Say("hi with param: " + v)
}
func (c *testControllerHandle) HiParamBy(v string) string {
return v
}
@@ -116,7 +121,8 @@ func TestControllerHandle(t *testing.T) {
// and can be used in a user-defined, dynamic "mvc handler".
e.GET("/hiservice").Expect().Status(httptest.StatusOK).
Body().Equal("service: hi")
e.GET("/hiservice/value").Expect().Status(httptest.StatusOK).
Body().Equal("service: hi with param: value")
// this worked with a temporary variadic on the resolvemethodfunc which is not
// correct design, I should split the path and params with the rest of implementation
// in order a simple template.Src can be given.