1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00
Former-commit-id: c55f1023f4d93f6712c7fa4d299bcf1098872ecf
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-07-25 09:23:34 +03:00
parent e70ceba051
commit 802348cedd
5 changed files with 68 additions and 1 deletions

View File

@@ -600,6 +600,7 @@ func (ctx *Context) StopWithText(statusCode int, plainText string) {
// StopWithError stops the handlers chain and writes the "statusCode"
// among with the error "err".
// It Calls the `SetErr` method so error handlers can access the given error.
//
// If the status code is a failure one then
// it will also fire the specified error code handler.
@@ -608,6 +609,7 @@ func (ctx *Context) StopWithError(statusCode int, err error) {
return
}
ctx.SetErr(err)
ctx.StopWithText(statusCode, err.Error())
}
@@ -4255,7 +4257,9 @@ func (ctx *Context) MaxAge() int64 {
// which can be used to reset the body, reset headers, get the body,
// get & set the status code at any time and more.
func (ctx *Context) Record() {
if w, ok := ctx.writer.(*responseWriter); ok {
switch w := ctx.writer.(type) {
case *ResponseRecorder:
default:
recorder := AcquireResponseRecorder()
recorder.BeginRecord(w)
ctx.ResetResponseWriter(recorder)