mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-02-13 07:25:10 -05:00
fix: bad format
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user