woj-server/internal/api/debug/random.go

22 lines
574 B
Go
Raw Normal View History

2022-09-07 23:34:37 +08:00
package debug
import (
2023-07-14 21:47:11 +08:00
"git.0x7f.app/WOJ/woj-server/internal/e"
"git.0x7f.app/WOJ/woj-server/pkg/utils"
2022-09-07 23:34:37 +08:00
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
// RandomString
// @Summary generate random string
// @Description Generate random string with length = 32.
2022-09-07 23:34:37 +08:00
// @Tags debug
// @Produce json
// @Response 200 {object} e.Response[string] "random string"
2022-09-07 23:34:37 +08:00
// @Router /debug/random [get]
func (h *handler) RandomString(c *gin.Context) {
2022-09-07 23:34:37 +08:00
str := utils.RandomString(32)
h.log.Info("random string", zap.String("str", str))
e.Pong(c, e.Success, str)
}