From 0764c2ed9fa11f3a492038989aa88c393a99440f Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Sun, 21 Feb 2016 22:09:36 +0100 Subject: [PATCH] Expect correct http status codes from discovery service --- discovery/endpoints.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discovery/endpoints.go b/discovery/endpoints.go index edf5620..cd27eef 100644 --- a/discovery/endpoints.go +++ b/discovery/endpoints.go @@ -92,10 +92,10 @@ func Add(ctx context.Context, baseURL string, n *Machine) (bool, error) { return false, err } defer func() { _ = resp.Body.Close() }() - if resp.StatusCode == http.StatusConflict { + if resp.StatusCode == http.StatusConflict || resp.StatusCode == http.StatusOK { return false, nil } - if resp.StatusCode != http.StatusOK { + if resp.StatusCode != http.StatusCreated { body, _ := ioutil.ReadAll(resp.Body) return false, fmt.Errorf("status code %d on PUT for %q: %s", resp.StatusCode, u, body) }