diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-08-19 08:49:59 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2021-08-19 08:49:59 +0300 |
commit | 2bd9d969ce88e05b3b2cb1ed06e4963fe3478360 (patch) | |
tree | a470b4c7c4389fa9e14d1e07f8d315d2d3185472 /test/acceptance/serving_test.go | |
parent | 111faf403e3df4c6e998a625f7ad8b22da4ff6ee (diff) | |
parent | 99bc678dfe8fc6f41a415c19ed5bfc64e162adc7 (diff) |
Merge branch 'fix/test-bodyclose' into 'master'
test: fix response body not being closed
See merge request gitlab-org/gitlab-pages!546
Diffstat (limited to 'test/acceptance/serving_test.go')
-rw-r--r-- | test/acceptance/serving_test.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/acceptance/serving_test.go b/test/acceptance/serving_test.go index a4f3085b..c42866ee 100644 --- a/test/acceptance/serving_test.go +++ b/test/acceptance/serving_test.go @@ -217,6 +217,7 @@ func TestCORSWhenDisabled(t *testing.T) { for _, spec := range supportedListeners() { for _, method := range []string{http.MethodGet, http.MethodHead, http.MethodOptions} { rsp := doCrossOriginRequest(t, spec, method, method, spec.URL("project/")) + defer rsp.Body.Close() require.Equal(t, http.StatusOK, rsp.StatusCode) require.Equal(t, "", rsp.Header.Get("Access-Control-Allow-Origin")) @@ -264,6 +265,7 @@ func TestCORSAllowsMethod(t *testing.T) { t.Run(tt.name, func(t *testing.T) { for _, spec := range supportedListeners() { rsp := doCrossOriginRequest(t, spec, tt.method, tt.method, spec.URL("project/")) + defer rsp.Body.Close() require.Equal(t, tt.expectedStatus, rsp.StatusCode) require.Equal(t, tt.expectedOrigin, rsp.Header.Get("Access-Control-Allow-Origin")) @@ -281,6 +283,7 @@ func TestCustomHeaders(t *testing.T) { for _, spec := range supportedListeners() { rsp, err := GetPageFromListener(t, spec, "group.gitlab-example.com:", "project/") require.NoError(t, err) + defer rsp.Body.Close() require.Equal(t, http.StatusOK, rsp.StatusCode) require.Equal(t, "Testing1", rsp.Header.Get("X-Test1")) require.Equal(t, "Testing2", rsp.Header.Get("X-Test2")) |