Package fitbit: Don't treat Conflict (409) as an error.
authorFlorian Forster <ff@octo.it>
Fri, 26 Jan 2018 20:43:27 +0000 (21:43 +0100)
committerFlorian Forster <ff@octo.it>
Fri, 26 Jan 2018 20:43:27 +0000 (21:43 +0100)
fitbit/fitbit.go

index 4555e22..bde96ff 100644 (file)
@@ -188,7 +188,7 @@ func (c *Client) Subscribe(ctx context.Context, collection string) error {
        }
        defer res.Body.Close()
 
-       if res.StatusCode >= 400 {
+       if res.StatusCode >= 400 && res.StatusCode != http.StatusConflict {
                data, _ := ioutil.ReadAll(res.Body)
                log.Errorf(ctx, "creating subscription failed: status %d %q", res.StatusCode, data)
                return fmt.Errorf("creating subscription failed")