mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 20:00:55 +00:00
Fixed bug: error page cannot show correct corresponding status code
This commit is contained in:
parent
7f4ad7ff46
commit
7f5dd13422
@ -189,6 +189,7 @@ func NotFound(rw http.ResponseWriter, r *http.Request) {
|
|||||||
"<br>You like 404 pages" +
|
"<br>You like 404 pages" +
|
||||||
"</ul>")
|
"</ul>")
|
||||||
data["BeegoVersion"] = VERSION
|
data["BeegoVersion"] = VERSION
|
||||||
|
rw.WriteHeader(http.StatusNotFound)
|
||||||
t.Execute(rw, data)
|
t.Execute(rw, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,6 +205,7 @@ func Unauthorized(rw http.ResponseWriter, r *http.Request) {
|
|||||||
"<br>Check the address for errors" +
|
"<br>Check the address for errors" +
|
||||||
"</ul>")
|
"</ul>")
|
||||||
data["BeegoVersion"] = VERSION
|
data["BeegoVersion"] = VERSION
|
||||||
|
rw.WriteHeader(http.StatusUnauthorized)
|
||||||
t.Execute(rw, data)
|
t.Execute(rw, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,6 +222,7 @@ func Forbidden(rw http.ResponseWriter, r *http.Request) {
|
|||||||
"<br>You need to log in" +
|
"<br>You need to log in" +
|
||||||
"</ul>")
|
"</ul>")
|
||||||
data["BeegoVersion"] = VERSION
|
data["BeegoVersion"] = VERSION
|
||||||
|
rw.WriteHeader(http.StatusForbidden)
|
||||||
t.Execute(rw, data)
|
t.Execute(rw, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +238,7 @@ func ServiceUnavailable(rw http.ResponseWriter, r *http.Request) {
|
|||||||
"<br>Please try again later." +
|
"<br>Please try again later." +
|
||||||
"</ul>")
|
"</ul>")
|
||||||
data["BeegoVersion"] = VERSION
|
data["BeegoVersion"] = VERSION
|
||||||
|
rw.WriteHeader(http.StatusServiceUnavailable)
|
||||||
t.Execute(rw, data)
|
t.Execute(rw, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,6 +253,7 @@ func InternalServerError(rw http.ResponseWriter, r *http.Request) {
|
|||||||
"<br>you should report the fault to the website administrator" +
|
"<br>you should report the fault to the website administrator" +
|
||||||
"</ul>")
|
"</ul>")
|
||||||
data["BeegoVersion"] = VERSION
|
data["BeegoVersion"] = VERSION
|
||||||
|
rw.WriteHeader(http.StatusInternalServerError)
|
||||||
t.Execute(rw, data)
|
t.Execute(rw, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,6 +445,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
//if no matches to url, throw a not found exception
|
//if no matches to url, throw a not found exception
|
||||||
if !findrouter {
|
if !findrouter {
|
||||||
if h, ok := ErrorMaps["404"]; ok {
|
if h, ok := ErrorMaps["404"]; ok {
|
||||||
|
w.status = 404
|
||||||
h(w, r)
|
h(w, r)
|
||||||
} else {
|
} else {
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
|
Loading…
Reference in New Issue
Block a user