1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 12:31:58 +00:00

Update to 8.0.4 | New: transfer a message to the request logger

Former-commit-id: 2bab3c9f28f7e9edd5d85e579349f70388af871d
This commit is contained in:
kataras
2017-07-17 17:42:51 +03:00
parent 56aa3de645
commit 093d087a68
13 changed files with 394 additions and 157 deletions

View File

@@ -803,10 +803,17 @@ func (ctx *context) BeginRequest(w http.ResponseWriter, r *http.Request) {
// 2. release the response writer
// and any other optional steps, depends on dev's application type.
func (ctx *context) EndRequest() {
if ctx.GetStatusCode() >= 400 && ctx.writer.Written() == -1 {
if !ctx.Application().ConfigurationReadOnly().GetDisableAutoFireStatusCode() {
if ctx.GetStatusCode() >= 400 &&
!ctx.Application().ConfigurationReadOnly().GetDisableAutoFireStatusCode() {
// author's note:
// if recording, the error handler can handle
// the rollback and remove any response written before,
// we don't have to do anything here, written is -1 when Recording
// because we didn't flush the response yet
// if !recording then check if the previous handler didn't send something
// to the client
if ctx.writer.Written() == -1 {
ctx.Application().FireErrorCode(ctx)
return
}
}