default value when lookup internal ip

This commit is contained in:
thuanle
2024-07-14 00:17:51 +07:00
parent cc8449c7b3
commit 9d07639d6c

View File

@@ -12,8 +12,11 @@ func HandleJson(c *gin.Context) {
ipData, _, err := data.Ins().Query(ip)
if err != nil {
log.Err(err).Msg("Failed to query IP")
c.String(http.StatusInternalServerError, "")
c.JSON(http.StatusOK, gin.H{
"ip": ip,
})
return
}
ipData["ip"] = ip
c.JSON(http.StatusOK, ipData)
}