1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

fix(http): drain and close response bodies EE-5486 (#8933)

This commit is contained in:
andres-portainer 2023-05-12 17:55:27 -03:00 committed by GitHub
parent 5b96136dd2
commit 511adabce2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 12 deletions

View file

@ -1,6 +1,7 @@
package security
import (
"io"
"net/http"
"net/http/httptest"
"testing"
@ -37,6 +38,8 @@ func TestLimitAccess(t *testing.T) {
if err != nil {
t.Fatal(err)
}
io.Copy(io.Discard, resp.Body)
resp.Body.Close()
if status := resp.StatusCode; status != http.StatusForbidden {
t.Errorf("handler returned wrong status code: got %v want %v",