diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 09:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 09:08:59 +0300 |
commit | 06bcbc77e472a70b8332150a941539c55953ef2b (patch) | |
tree | 903ff19991a3c3234626b1e86827a42063eeac61 /workhorse/internal/api | |
parent | 1325f8cf2dce0f24403ea27c4ee58afd51fa3a8e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'workhorse/internal/api')
-rw-r--r-- | workhorse/internal/api/api.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/workhorse/internal/api/api.go b/workhorse/internal/api/api.go index a00cff34b89..3abc735dc90 100644 --- a/workhorse/internal/api/api.go +++ b/workhorse/internal/api/api.go @@ -3,7 +3,6 @@ package api import ( "bytes" "encoding/json" - "errors" "fmt" "io" "net/http" @@ -310,18 +309,18 @@ func (api *API) PreAuthorizeFixedPath(r *http.Request, method string, path strin } authReq.Header = helper.HeaderClone(r.Header) - ignoredResponse, apiResponse, err := api.PreAuthorize(path, authReq) + failureResponse, apiResponse, err := api.PreAuthorize(path, authReq) if err != nil { return nil, fmt.Errorf("PreAuthorize: %w", err) } - // We don't need the contents of ignoredResponse but we are responsible + // We don't need the contents of failureResponse but we are responsible // for closing it. Part of the reason PreAuthorizeFixedPath exists is to // hide this awkwardness. - ignoredResponse.Body.Close() + failureResponse.Body.Close() if apiResponse == nil { - return nil, errors.New("no api response on fixed path") + return nil, fmt.Errorf("no api response: status %d", failureResponse.StatusCode) } return apiResponse, nil |