Grafana: Replace magic number with a constant variable in response status (#80132)
* Chore: Replace response status with const var * Apply suggestions from code review Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com> * Add net/http import --------- Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
co-authored by
Sofia Papagiannaki
parent
a7fbe3c6dc
commit
96dfb385ca
@@ -56,7 +56,7 @@ func notAuthorized(c *contextmodel.ReqContext) {
|
||||
|
||||
func tokenRevoked(c *contextmodel.ReqContext, err *auth.TokenRevokedError) {
|
||||
if c.IsApiRequest() {
|
||||
c.JSON(401, map[string]any{
|
||||
c.JSON(http.StatusUnauthorized, map[string]any{
|
||||
"message": "Token revoked",
|
||||
"error": map[string]any{
|
||||
"id": "ERR_TOKEN_REVOKED",
|
||||
|
||||
@@ -170,9 +170,9 @@ func Recovery(cfg *setting.Cfg, license licensing.Licensing) web.Middleware {
|
||||
resp["error"] = data.Title
|
||||
}
|
||||
|
||||
ctx.JSON(500, resp)
|
||||
ctx.JSON(http.StatusInternalServerError, resp)
|
||||
} else {
|
||||
ctx.HTML(500, cfg.ErrTemplateName, data)
|
||||
ctx.HTML(http.StatusInternalServerError, cfg.ErrTemplateName, data)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user