From 1378006d51457f50bd92bdc7bb6dcbd1e6e81a3c Mon Sep 17 00:00:00 2001 From: lowitea Date: Thu, 1 Jul 2021 16:28:36 +0300 Subject: [PATCH 1/2] Fixes CustomAbort Always set the response status in the CustomAbort function --- server/web/controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/web/controller.go b/server/web/controller.go index 103dd08f..700bd03e 100644 --- a/server/web/controller.go +++ b/server/web/controller.go @@ -411,9 +411,9 @@ func (c *Controller) Abort(code string) { // CustomAbort stops controller handler and show the error data, it's similar Aborts, but support status code and body. func (c *Controller) CustomAbort(status int, body string) { + c.Ctx.Output.Status = status // first panic from ErrorMaps, it is user defined error functions. if _, ok := ErrorMaps[body]; ok { - c.Ctx.Output.Status = status panic(body) } // last panic user string From e359806f33d37eff2cd7c5bae4f0088778fb358a Mon Sep 17 00:00:00 2001 From: lowit Date: Sun, 4 Jul 2021 22:38:23 +0300 Subject: [PATCH 2/2] patch-1: adds a changelog entity --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bd9978e..e0a07cfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # developing +- Always set the response status in the CustomAbort function. [4686](https://github.com/beego/beego/pull/4686) - Add template functions eq,lt to support uint and int compare. [4607](https://github.com/beego/beego/pull/4607) - Migrate tests to GitHub Actions. [4663](https://github.com/beego/beego/issues/4663) - Add http client and option func. [4455](https://github.com/beego/beego/issues/4455)