Replace json decoder with io.ReadAll (#57178) (#57251)

(cherry picked from commit 0b72c36527)

Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-10-19 06:03:47 -04:00
committed by GitHub
co-authored by Dimitris Sotirakis
parent 9f8bee7187
commit c4fdc3d7c6
+1 -4
View File
@@ -275,10 +275,7 @@ func postRequest(cfg packaging.PublishConfig, pth string, obj interface{}, descr
}
}()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
var body []byte
if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
return err
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return err
}