From 666a8fb0a4d7316e71375b6adeeba3c4b0ce67c7 Mon Sep 17 00:00:00 2001 From: Ivan Ilves Date: Tue, 4 Feb 2020 10:15:16 +0100 Subject: [PATCH] chore(auth): Do not skip tracing/header printing on 5xx/4xx code --- api/v1/registry/client/request/request.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/v1/registry/client/request/request.go b/api/v1/registry/client/request/request.go index b59f0d0..4f7af35 100644 --- a/api/v1/registry/client/request/request.go +++ b/api/v1/registry/client/request/request.go @@ -54,9 +54,6 @@ func perform(url, auth, mode string, trace bool) (resp *http.Response, err error if err != nil { return nil, err } - if resp.StatusCode != 200 && resp.StatusCode != 404 { - return resp, errors.New("Bad response status: " + resp.Status + " >> " + url) - } if trace { fmt.Printf("%s|@URL: %s\n", rid, url) @@ -70,6 +67,10 @@ func perform(url, auth, mode string, trace bool) (resp *http.Response, err error fmt.Printf("%s|--- BODY END ---\n", rid) } + if resp.StatusCode != 200 && resp.StatusCode != 404 { + return resp, errors.New("Bad response status: " + resp.Status + " >> " + url) + } + return resp, nil }