Revert "Replace ioutil.ReadAll with a buffered decoder"

This reverts commit 05e314ed1f.
This commit is contained in:
Benedikt Kulmann
2020-10-05 14:59:27 +02:00
parent e145c3be77
commit b49126e234

View File

@@ -5,6 +5,7 @@ import (
"context"
"encoding/json"
"io"
"io/ioutil"
"net/http"
"path"
"strings"
@@ -92,9 +93,8 @@ func (r CS3Repo) LoadAccount(ctx context.Context, id string, a *proto.Account) (
return &notFoundErr{"account", id}
}
dec := json.NewDecoder(resp.Body)
var b []byte
if err = dec.Decode(&b); err != nil {
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
if err = resp.Body.Close(); err != nil {
@@ -167,9 +167,8 @@ func (r CS3Repo) LoadGroup(ctx context.Context, id string, g *proto.Group) (err
return &notFoundErr{"group", id}
}
dec := json.NewDecoder(resp.Body)
var b []byte
if err = dec.Decode(&b); err != nil {
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
if err = resp.Body.Close(); err != nil {