diff --git a/main.go b/main.go index f1916a5..97cc493 100644 --- a/main.go +++ b/main.go @@ -34,6 +34,7 @@ func main() { if err != nil { log.Fatalln("Could not parse provided JSON") } + if !slices.Contains(spaceApiResponse.APICompatibility, "14") { log.Fatalln("Provided JSON doesn't specify compatibility with API version 14") } @@ -75,7 +76,7 @@ func main() { body, err := io.ReadAll(r.Body) if err != nil { - log.Println("Failed to read body status update request from", r.RemoteAddr) + log.Println("Failed to read request body from", r.RemoteAddr) w.WriteHeader(http.StatusInternalServerError) _, _ = io.WriteString(w, "Failed reading HTTP request body") return @@ -83,6 +84,7 @@ func main() { newState, err := strconv.ParseBool(string(body)) if err != nil { + log.Println("Failed to parse request body from", r.RemoteAddr) w.WriteHeader(http.StatusBadRequest) _, _ = io.WriteString(w, "HTTP request body should either be true or false") return