Skip to content

Commit f3e46ac

Browse files
committed
fix: validate token type if it's defined
1 parent 58daf2e commit f3e46ac

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/handlers/token_handlers.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ func GetTokenBalancesByType(c *gin.Context) {
5353
tokenType = c.Query("token_type")
5454
}
5555

56+
if tokenType != "" && tokenType != "erc20" && tokenType != "erc1155" && tokenType != "erc721" {
57+
api.BadRequestErrorHandler(c, fmt.Errorf("invalid token type '%s'", tokenType))
58+
return
59+
}
5660
owner := strings.ToLower(c.Param("owner"))
5761
if !strings.HasPrefix(owner, "0x") {
5862
api.BadRequestErrorHandler(c, fmt.Errorf("invalid owner address '%s'", owner))

0 commit comments

Comments
 (0)