1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

Release version 12.2.0-beta2

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-05-09 03:01:34 +03:00
parent d989044054
commit 02077a01fa
9 changed files with 88 additions and 7 deletions

View File

@@ -841,7 +841,7 @@ func (ctx *Context) StopWithPlainError(statusCode int, err error) {
// it will also fire the specified error code handler.
func (ctx *Context) StopWithJSON(statusCode int, jsonObject interface{}) error {
ctx.StopWithStatus(statusCode)
_, err := ctx.writeJSON(jsonObject, nil)
_, err := ctx.writeJSON(jsonObject, nil) // do not modify - see errors.DefaultContextErrorHandler.
return err
}
@@ -3975,9 +3975,14 @@ type (
// ErrorHandler describes a context error handler which applies on
// JSON, JSONP, Protobuf, MsgPack, XML, YAML and Markdown write errors.
//
// It does NOT modify or handle the result of Context.GetErr at all,
// use a custom middleware instead if you want to handle the handler-provided custom errors (Context.SetErr)
//
// An ErrorHandler can be registered once via Application.SetErrorHandler method to override the default behavior.
// The default behavior is to simply send status internal code error
// without a body back to the client.
//
// See Application.SetContextErrorHandler for more.
ErrorHandler interface {
HandleContextError(ctx *Context, err error)
}

View File

@@ -143,6 +143,11 @@ func (w *ResponseRecorder) ClearHeaders() {
// Reset clears headers, sets the status code to 200
// and clears the cached body.
//
// - Use ResetBody() and ResetHeaders() instead to keep compression after reseting.
//
// - Use Reset() & ResponseRecorder.ResponseWriter.(*context.CompressResponseWriter).Disabled = true
// to set a new body without compression when the previous handler was iris.Compression.
//
// Implements the `ResponseWriterReseter`.
func (w *ResponseRecorder) Reset() bool {
w.ClearHeaders()