Skip to content

Commit

Permalink
internal/remoteconfig: ignore empty update
Browse files Browse the repository at this point in the history
  • Loading branch information
Julio-Guerra committed Dec 16, 2022
1 parent 0c6e458 commit 1122a62
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/remoteconfig/remoteconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,19 @@ func (c *Client) updateState() {
return
}

respBody, err := io.ReadAll(resp.Body)
if err != nil {
log.Error("remoteconfig: http request error: could not read the response body: %v", err)
return
}

if body := string(respBody); body == `{}` || body == `null` {
return
}

var update clientGetConfigsResponse
if err := json.NewDecoder(resp.Body).Decode(&update); err != nil {
log.Error("remoteconfig: http request: could not parse the json response body: %v", err)
if err := json.Unmarshal(respBody, &update); err != nil {
log.Error("remoteconfig: http request error: could not parse the json response body: %v", err)
return
}

Expand Down

0 comments on commit 1122a62

Please sign in to comment.