From e12b6abe0047c891a81c9d8f2231663ff9fc3563 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Wed, 2 May 2018 11:53:44 +0200 Subject: [PATCH] Properly check for status 200 --- plugin.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin.go b/plugin.go index 3b4cb34..e11b36d 100644 --- a/plugin.go +++ b/plugin.go @@ -81,6 +81,10 @@ func (p Plugin) Exec() error { defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return errors.Errorf("request failed, status %s", http.StatusText(resp.StatusCode)) + } + target, err := os.Create(destination) if err != nil {