From 7c6a9d7568521fdbf1aa0d4e6e7b6108d477ce70 Mon Sep 17 00:00:00 2001 From: Xin Zhang Date: Sat, 12 Oct 2019 16:07:00 +0800 Subject: [PATCH] Fix check status code Signed-off-by: Xin Zhang --- prometheus/push/push.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prometheus/push/push.go b/prometheus/push/push.go index e048809..d8bfd84 100644 --- a/prometheus/push/push.go +++ b/prometheus/push/push.go @@ -267,7 +267,7 @@ func (p *Pusher) push(method string) error { return err } defer resp.Body.Close() - if resp.StatusCode != 202 { + if resp.StatusCode != 200 && resp.StatusCode != 202 { body, _ := ioutil.ReadAll(resp.Body) // Ignore any further error as this is for an error message only. return fmt.Errorf("unexpected status code %d while pushing to %s: %s", resp.StatusCode, p.fullURL(), body) }