Unverified Commit f2589383 authored by astaxie's avatar astaxie Committed by GitHub

Merge pull request #3142 from amitash1109/fix_response_http_code

Fix response http code
parents 67a6b872 af73a2d5
...@@ -182,7 +182,11 @@ func recoverPanic(ctx *context.Context) { ...@@ -182,7 +182,11 @@ func recoverPanic(ctx *context.Context) {
if BConfig.RunMode == DEV && BConfig.EnableErrorsRender { if BConfig.RunMode == DEV && BConfig.EnableErrorsRender {
showErr(err, ctx, stack) showErr(err, ctx, stack)
} }
ctx.ResponseWriter.WriteHeader(500) if ctx.Output.Status != 0 {
ctx.ResponseWriter.WriteHeader(ctx.Output.Status)
} else {
ctx.ResponseWriter.WriteHeader(500)
}
} }
} }
......
...@@ -93,11 +93,6 @@ func showErr(err interface{}, ctx *context.Context, stack string) { ...@@ -93,11 +93,6 @@ func showErr(err interface{}, ctx *context.Context, stack string) {
"BeegoVersion": VERSION, "BeegoVersion": VERSION,
"GoVersion": runtime.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) t.Execute(ctx.ResponseWriter, data)
} }
......
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