1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 06:20:54 +00:00

move filter wrong http method

This commit is contained in:
astaxie 2014-08-04 16:21:34 +08:00
parent d7a5281bda
commit 885c0678ff

View File

@ -578,6 +578,13 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
return false
}
// filter wrong httpmethod
if _, ok := HTTPMETHOD[r.Method]; !ok {
http.Error(w, "Method Not Allowed", 405)
goto Admin
}
// filter for static file
if do_filter(BeforeStatic) {
goto Admin
}
@ -595,11 +602,6 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
}()
}
if _, ok := HTTPMETHOD[r.Method]; !ok {
http.Error(w, "Method Not Allowed", 405)
goto Admin
}
if r.Method != "GET" && r.Method != "HEAD" {
if CopyRequestBody && !context.Input.IsUpload() {
context.Input.CopyBody()