From 888e5fe84c01f428d3f0645e3efeec6dd94e64d4 Mon Sep 17 00:00:00 2001 From: Xin Zhang Date: Sat, 12 Oct 2019 13:57:32 +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 e048809f6..0e927a8af 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) }