From 7242bc862ea1ccf0f20d7419c890657fda01b615 Mon Sep 17 00:00:00 2001 From: astaxie Date: Wed, 18 Dec 2013 23:48:43 +0800 Subject: [PATCH] improve main login performance --- router.go | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/router.go b/router.go index 59e721e6..d9f6f049 100644 --- a/router.go +++ b/router.go @@ -709,9 +709,26 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) if !w.started { //exec main logic - in := make([]reflect.Value, 0) - method := vc.MethodByName(runMethod) - method.Call(in) + switch runMethod { + case "Get": + execController.Get() + case "Post": + execController.Post() + case "Delete": + execController.Delete() + case "Put": + execController.Put() + case "Head": + execController.Head() + case "Patch": + execController.Patch() + case "Options": + execController.Options() + default: + in := make([]reflect.Value, 0) + method := vc.MethodByName(runMethod) + method.Call(in) + } //render template if !w.started && !context.Input.IsWebsocket() {