add: server shutdown, tests

This commit is contained in:
$(pass /github/name)
2024-08-20 21:56:36 +02:00
parent 6f42f715a7
commit 15d80889d1
7 changed files with 105 additions and 18 deletions

View File

@@ -29,15 +29,15 @@ func (mc *MembershipController) RegisterSubscription(c *gin.Context) {
}
logger.Info.Printf("Using API key: %v", config.Auth.APIKEY)
if regData.APIKey == "" {
logger.Error.Println("API Key is missing")
c.JSON(http.StatusBadRequest, "API Key is missing")
c.JSON(http.StatusUnauthorized, "API Key is missing")
return
}
if regData.APIKey != config.Auth.APIKEY {
logger.Error.Printf("API Key not valid: %v", regData.APIKey)
c.JSON(http.StatusExpectationFailed, "API Key is missing")
c.JSON(http.StatusUnauthorized, "API Key is missing")
return
}