Skip to content

Commit

Permalink
check status code when polling finished
Browse files Browse the repository at this point in the history
Signed-off-by: walkure <[email protected]>
  • Loading branch information
walkure committed Jan 23, 2023
1 parent 9955b76 commit 60cd408
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ func (c *Coordinator) doPoll(client *http.Client) error {
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
level.Warn(c.logger).Log("msg", "Unexpected response", "statusCode", resp.StatusCode)
return fmt.Errorf("unexpected response status=%d", resp.StatusCode)
}

request, err := http.ReadRequest(bufio.NewReader(resp.Body))
if err != nil {
level.Error(c.logger).Log("msg", "Error reading request:", "err", err)
Expand Down

0 comments on commit 60cd408

Please sign in to comment.