Skip to content

Commit

Permalink
chore: do not return 404 if no stats are available on /stats endpoint (
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech authored Oct 8, 2024
1 parent f6d200b commit 32cca0c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions livestream/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,18 @@ 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
}
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")
}
Expand Down
2 changes: 1 addition & 1 deletion livestream/served.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 32cca0c

Please sign in to comment.