mirror of
https://github.com/kataras/iris.git
synced 2025-12-21 11:57:02 +00:00
add the ability to add custom parameter types to the interpreter and mapped macros with any number of macro functions - example added - although it's working it is not ready yet - I have to do some cleanup, doc comments and a TODO
Former-commit-id: 8ac751b649a3b8e59948fd4c89ad53d25f49d0d5
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user