From 1a81e49d05abc6ff5b3d45c5335f512e6156ebb3 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Tue, 5 Feb 2019 15:15:58 -0800 Subject: [PATCH] Return error loading config on non-200 response --- internal/config/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/config/config.go b/internal/config/config.go index a24781949..504d8501c 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -772,6 +772,11 @@ func fetchConfig(u *url.URL) ([]byte, error) { if err != nil { return nil, err } + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("failed to retrieve remote config: %s", resp.Status) + } + defer resp.Body.Close() return ioutil.ReadAll(resp.Body) }