mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 06:10:55 +00:00
Fix response http code
This commit is contained in:
parent
f16688817a
commit
6df42d63e2
@ -182,6 +182,11 @@ func recoverPanic(ctx *context.Context) {
|
||||
if BConfig.RunMode == DEV && BConfig.EnableErrorsRender {
|
||||
showErr(err, ctx, stack)
|
||||
}
|
||||
if ctx.Output.Status != 0 {
|
||||
ctx.ResponseWriter.WriteHeader(ctx.Output.Status)
|
||||
} else {
|
||||
ctx.ResponseWriter.WriteHeader(500)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
5
error.go
5
error.go
@ -93,11 +93,6 @@ func showErr(err interface{}, ctx *context.Context, stack string) {
|
||||
"BeegoVersion": VERSION,
|
||||
"GoVersion": runtime.Version(),
|
||||
}
|
||||
if ctx.Output.Status != 0 {
|
||||
ctx.ResponseWriter.WriteHeader(ctx.Output.Status)
|
||||
} else {
|
||||
ctx.ResponseWriter.WriteHeader(500)
|
||||
}
|
||||
t.Execute(ctx.ResponseWriter, data)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user