fix(backend): ensure we always close zsrd reader

Fixes #1762
This commit is contained in:
Łukasz Mierzwa
2020-05-19 19:22:14 +01:00
committed by Łukasz Mierzwa
parent dd60e608bd
commit 8cfbd741a8
2 changed files with 2 additions and 1 deletions

View File

@@ -68,6 +68,7 @@ func decompressCachedResponse(data []byte) ([]byte, error) {
return nil, fmt.Errorf("failed to created new compression reader: %s", err.Error())
}
defer r.Close()
p, err := ioutil.ReadAll(r)
if err != nil {
return nil, fmt.Errorf("failed to decompress data: %s", err.Error())

View File

@@ -18,7 +18,6 @@ import (
"github.com/prymitive/karma/internal/mock"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/slices"
"github.com/spf13/pflag"
cache "github.com/patrickmn/go-cache"
log "github.com/sirupsen/logrus"
@@ -26,6 +25,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/google/go-cmp/cmp"
"github.com/jarcoal/httpmock"
"github.com/spf13/pflag"
)
var upstreamSetup = false