Skip to content

Commit

Permalink
Fix version check when req body is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ameshkov committed Jul 10, 2020
1 parent ab401ca commit fdf6089
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions home/control_update.go
Expand Up @@ -45,10 +45,13 @@ func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) {
}

req := getVersionJSONRequest{}
err := json.NewDecoder(r.Body).Decode(&req)
if err != nil {
httpError(w, http.StatusBadRequest, "JSON parse: %s", err)
return
var err error
if r.ContentLength != 0 {
err = json.NewDecoder(r.Body).Decode(&req)
if err != nil {
httpError(w, http.StatusBadRequest, "JSON parse: %s", err)
return
}
}

now := time.Now()
Expand Down

0 comments on commit fdf6089

Please sign in to comment.