diff --git a/restapi/auth.go b/restapi/auth.go index c034bee9..32538b9a 100644 --- a/restapi/auth.go +++ b/restapi/auth.go @@ -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() } -} \ No newline at end of file +} diff --git a/restapi/serve.go b/restapi/serve.go index c9b364a9..90bf6c0e 100644 --- a/restapi/serve.go +++ b/restapi/serve.go @@ -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