diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-19 15:08:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-19 15:08:27 +0300 |
commit | 4a44059e43feeef9e03fe99096de5035806c9f8f (patch) | |
tree | 4af11effe8e487422fe4dd1c815bd7635324415f /workhorse/internal/api | |
parent | 570f4d7ae78b453d9816f4f328bcd3941fbd0f37 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'workhorse/internal/api')
-rw-r--r-- | workhorse/internal/api/api.go | 5 | ||||
-rw-r--r-- | workhorse/internal/api/block.go | 3 | ||||
-rw-r--r-- | workhorse/internal/api/block_test.go | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/workhorse/internal/api/api.go b/workhorse/internal/api/api.go index 1f8266bf609..1758bb5a6a8 100644 --- a/workhorse/internal/api/api.go +++ b/workhorse/internal/api/api.go @@ -18,6 +18,7 @@ import ( "gitlab.com/gitlab-org/gitlab/workhorse/internal/config" "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper/fail" "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" "gitlab.com/gitlab-org/gitlab/workhorse/internal/secret" ) @@ -335,7 +336,7 @@ func (api *API) PreAuthorizeHandler(next HandleFunc, suffix string) http.Handler } if err != nil { - helper.Fail500(w, r, err) + fail.Request(w, r, err) return } @@ -390,7 +391,7 @@ func passResponseBack(httpResponse *http.Response, w http.ResponseWriter, r *htt // the entire response body in memory before sending it on. responseBody, err := bufferResponse(httpResponse.Body) if err != nil { - helper.Fail500(w, r, err) + fail.Request(w, r, err) return } httpResponse.Body.Close() // Free up the Puma thread diff --git a/workhorse/internal/api/block.go b/workhorse/internal/api/block.go index 43763fc2b13..aac43f8cf77 100644 --- a/workhorse/internal/api/block.go +++ b/workhorse/internal/api/block.go @@ -5,6 +5,7 @@ import ( "net/http" "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper" + "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper/fail" ) // Prevent internal API responses intended for gitlab-workhorse from @@ -48,7 +49,7 @@ func (b *blocker) WriteHeader(status int) { b.status = 500 b.Header().Del("Content-Length") b.hijacked = true - helper.Fail500(b.rw, b.r, fmt.Errorf("api.blocker: forbidden content-type: %q", ResponseContentType)) + fail.Request(b.rw, b.r, fmt.Errorf("api.blocker: forbidden content-type: %q", ResponseContentType)) return } diff --git a/workhorse/internal/api/block_test.go b/workhorse/internal/api/block_test.go index 0beb401d2f5..c1ffe93dfb8 100644 --- a/workhorse/internal/api/block_test.go +++ b/workhorse/internal/api/block_test.go @@ -20,7 +20,7 @@ func TestBlocker(t *testing.T) { { desc: "blocked", contentType: ResponseContentType, - out: "Internal server error\n", + out: "Internal Server Error\n", }, { desc: "pass", |