Merge pull request #4686 from lowitea/patch-1
Always set the response status in the CustomAbort function
This commit is contained in:
commit
12af439a9c
@ -1,5 +1,6 @@
|
|||||||
# developing
|
# 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)
|
- 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)
|
- 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)
|
- Add http client and option func. [4455](https://github.com/beego/beego/issues/4455)
|
||||||
|
|||||||
@ -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.
|
// 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) {
|
func (c *Controller) CustomAbort(status int, body string) {
|
||||||
|
c.Ctx.Output.Status = status
|
||||||
// first panic from ErrorMaps, it is user defined error functions.
|
// first panic from ErrorMaps, it is user defined error functions.
|
||||||
if _, ok := ErrorMaps[body]; ok {
|
if _, ok := ErrorMaps[body]; ok {
|
||||||
c.Ctx.Output.Status = status
|
|
||||||
panic(body)
|
panic(body)
|
||||||
}
|
}
|
||||||
// last panic user string
|
// last panic user string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user