From d67b534a2627b839dec9689195d525de4b32a6ba Mon Sep 17 00:00:00 2001 From: ChimanJain <36687396+ChimanJain@users.noreply.github.com> Date: Mon, 18 Apr 2022 18:03:59 +0530 Subject: [PATCH] Bug fix When the `response status` is ok, the beego application sets it to `0`. To fix that when we send the notice to airbrake, we overwrite the status to StatusOK i.e. `200` --- beego/filter.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/beego/filter.go b/beego/filter.go index 030fba0..f936d1a 100644 --- a/beego/filter.go +++ b/beego/filter.go @@ -29,7 +29,11 @@ func New(notifier *gobrake.Notifier) web.FilterChain { } _, metric := gobrake.NewRouteMetric(goctx.TODO(), ctx.Input.Method(), routerPattern) next(ctx) - metric.StatusCode = ctx.ResponseWriter.Status + statusCode := ctx.ResponseWriter.Status + if statusCode == 0 { + statusCode = 200 + } + metric.StatusCode = statusCode _ = notifier.Routes.Notify(goctx.TODO(), metric) }