chore: do not return 404 if no stats are available on /stats endpoint (#25462)

This commit is contained in:
James Greenhill
2024-10-08 15:32:21 -07:00
committed by GitHub
parent f6d200bc00
commit 32cca0c287
2 changed files with 1 additions and 4 deletions

View File

@@ -127,13 +127,11 @@ func main() {
} else {
teamId = ""
log.Println("~~~~ Looking for auth header")
authHeader := c.Request().Header.Get("Authorization")
if authHeader == "" {
return errors.New("authorization header is required")
}
log.Println("~~~~ decoding auth header")
claims, err := decodeAuthToken(authHeader)
if err != nil {
return err
@@ -141,7 +139,6 @@ func main() {
teamId = strconv.Itoa(int(claims["team_id"].(float64)))
token = fmt.Sprint(claims["api_token"])
log.Printf("~~~~ team found %s", teamId)
if teamId == "" {
return errors.New("teamId is required unless geo=true")
}

View File

@@ -51,7 +51,7 @@ func statsHandler(stats *Stats) func(c echo.Context) error {
resp := resp{
Error: "no stats",
}
return c.JSON(http.StatusNotFound, resp)
return c.JSON(http.StatusOK, resp)
}
siteStats := resp{