Commit 912abe32 authored by astaxie's avatar astaxie

fix #1388

parent 4ba50e5d
......@@ -353,7 +353,7 @@ func (p *ControllerRegister) Handler(pattern string, h http.Handler, options ...
route.handler = h
if len(options) > 0 {
if _, ok := options[0].(bool); ok {
pattern = path.Join(pattern, "?:all")
pattern = path.Join(pattern, "?:all(.*)")
}
}
for _, m := range HTTPMETHOD {
......
......@@ -333,6 +333,18 @@ func TestRouterHandler(t *testing.T) {
}
}
func TestRouterHandlerAll(t *testing.T) {
r, _ := http.NewRequest("POST", "/sayhi/a/b/c", nil)
w := httptest.NewRecorder()
handler := NewControllerRegister()
handler.Handler("/sayhi", http.HandlerFunc(sayhello), true)
handler.ServeHTTP(w, r)
if w.Body.String() != "sayhello" {
t.Errorf("TestRouterHandler can't run")
}
}
//
// Benchmarks NewApp:
//
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment