fix: bad format

This commit is contained in:
Harold
2025-04-01 01:19:57 +02:00
committed by HaroldFinchIFT
parent 15a2eeadc9
commit ceaa90a7c7
2 changed files with 4 additions and 4 deletions

View File

@@ -1,8 +1,8 @@
package restapi
import (
"net/http"
"fmt"
"net/http"
"github.com/gin-gonic/gin"
)
@@ -12,10 +12,10 @@ func ApiKeyMiddleware(apiKey string) gin.HandlerFunc {
headerApiKey := c.GetHeader("X-API-Key")
if headerApiKey != apiKey {
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": fmt.Sprintf("Wrong or missing API Key")})
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": fmt.Sprintf("Wrong or missing API Key")})
return
}
c.Next()
}
}
}

View File

@@ -13,7 +13,7 @@ func Serve(registry *core.PluginRegistry, address string, apiKey string) (err er
r.Use(gin.Recovery())
if apiKey != "" {
r.Use(ApiKeyMiddleware(apiKey))
r.Use(ApiKeyMiddleware(apiKey))
}
// Register routes