use const http status text instead of a variable (#921)

This commit is contained in:
Curith 2022-04-21 11:30:25 +08:00 committed by GitHub
parent 808fa5839a
commit 5e763f1a8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 5 deletions

View File

@ -4,7 +4,7 @@ var (
dict = map[string]string{
"just a test": "这只是一个测试",
"just a test: %s": "这只是一个测试: %s",
"InternalServerError": "系统内部错误,请联系管理员",
"Internal Server Error": "系统内部错误,请联系管理员",
"Username or password invalid": "登录失败,请检查用户名和密码",
"Username is blank": "用户名不能为空",
"Username has invalid characters": "用户名含有非法字符",

View File

@ -17,8 +17,6 @@ import (
promstat "github.com/didi/nightingale/v5/src/webapi/stat"
)
var InternalServerError = "InternalServerError"
func stat() gin.HandlerFunc {
return func(c *gin.Context) {
start := time.Now()

View File

@ -68,7 +68,7 @@ func logoutPost(c *gin.Context) {
delErr := deleteTokens(c.Request.Context(), metadata)
if delErr != nil {
ginx.NewRender(c).Message(InternalServerError)
ginx.NewRender(c).Message(http.StatusText(http.StatusInternalServerError))
return
}
@ -118,7 +118,7 @@ func refreshPost(c *gin.Context) {
// Delete the previous Refresh Token
err = deleteAuth(c.Request.Context(), refreshUuid)
if err != nil {
ginx.NewRender(c, http.StatusUnauthorized).Message(InternalServerError)
ginx.NewRender(c, http.StatusUnauthorized).Message(http.StatusText(http.StatusInternalServerError))
return
}