Commit efc14a1e authored by WithGJR's avatar WithGJR

fix router bug with more better way

parent fa128100
...@@ -648,20 +648,16 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -648,20 +648,16 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
} }
if !findrouter { if !findrouter {
http_method := "" http_method := r.Method
if r.Method == "POST" && context.Input.Query("_method") == "PUT" { if http_method == "POST" && context.Input.Query("_method") == "PUT" {
http_method = "PUT" http_method = "PUT"
} }
if r.Method == "POST" && context.Input.Query("_method") == "DELETE" { if http_method == "POST" && context.Input.Query("_method") == "DELETE" {
http_method = "DELETE" http_method = "DELETE"
} }
if http_method != "PUT" && http_method != "DELETE" {
http_method = r.Method
}
if t, ok := p.routers[http_method]; ok { if t, ok := p.routers[http_method]; ok {
runObject, p := t.Match(urlPath) runObject, p := t.Match(urlPath)
if r, ok := runObject.(*controllerInfo); ok { if r, ok := runObject.(*controllerInfo); ok {
......
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