mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 23:01:28 +00:00
when call middle.Exception should set w.WriteHeader first
This commit is contained in:
parent
e01fbd497c
commit
079a41136e
@ -294,6 +294,11 @@ func RegisterErrorHander() {
|
|||||||
|
|
||||||
func Exception(errcode string, w http.ResponseWriter, r *http.Request, msg string) {
|
func Exception(errcode string, w http.ResponseWriter, r *http.Request, msg string) {
|
||||||
if h, ok := ErrorMaps[errcode]; ok {
|
if h, ok := ErrorMaps[errcode]; ok {
|
||||||
|
isint, err := strconv.Atoi(errcode)
|
||||||
|
if err != nil {
|
||||||
|
isint = 500
|
||||||
|
}
|
||||||
|
w.WriteHeader(isint)
|
||||||
h(w, r)
|
h(w, r)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user