mirror of
https://github.com/wahyd4/badger.git
synced 2026-08-09 05:15:58 +10:00
Trim space when submmiting request
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
svg "github.com/ajstarks/svgo"
|
||||
@@ -120,6 +121,11 @@ func (handler *BadgesHandler) UpdateBadgeValue(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if request.Value == "" || strings.TrimSpace(request.Value) == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request"})
|
||||
return
|
||||
}
|
||||
|
||||
queryName := c.Param("name")
|
||||
|
||||
badge, err := handler.queryBadgeFromDB(queryName)
|
||||
|
||||
Reference in New Issue
Block a user