From c6d9f1492cc492f14e91aaeb7718af80530bc0a1 Mon Sep 17 00:00:00 2001 From: Pedro Felipe Dominguite Date: Wed, 6 Jan 2021 16:22:11 -0300 Subject: [PATCH] Add read stream error handler Signed-off-by: Pedro Felipe Dominguite --- pkg/scalers/openstack/keystone_authentication.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/scalers/openstack/keystone_authentication.go b/pkg/scalers/openstack/keystone_authentication.go index ae6778ba64e..dd798916c13 100644 --- a/pkg/scalers/openstack/keystone_authentication.go +++ b/pkg/scalers/openstack/keystone_authentication.go @@ -95,7 +95,11 @@ func (authProps *KeystoneAuthMetadata) GetToken() (string, error) { return resp.Header["X-Subject-Token"][0], nil } - errBody, _ := ioutil.ReadAll(resp.Body) + errBody, readBodyErr := ioutil.ReadAll(resp.Body) + + if readBodyErr != nil { + return "", readBodyErr + } return "", fmt.Errorf(string(errBody)) }