Replace json decoder with io.ReadAll (#57178)

This commit is contained in:
Dimitris Sotirakis 2022-10-19 12:51:24 +03:00 committed by GitHub
parent b997bc4200
commit 0b72c36527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}