diff --git a/pkg/scalers/artemis_scaler.go b/pkg/scalers/artemis_scaler.go index df8d9a1480a..7ba5e36f1dc 100644 --- a/pkg/scalers/artemis_scaler.go +++ b/pkg/scalers/artemis_scaler.go @@ -238,13 +238,12 @@ func (s *artemisScaler) getQueueMessageCount(ctx context.Context) (int64, error) url := s.getMonitoringEndpoint() req, err := http.NewRequestWithContext(ctx, "GET", url, nil) - - req.SetBasicAuth(s.metadata.username, s.metadata.password) - req.Header.Set("Origin", s.metadata.corsHeader) - if err != nil { return -1, err } + req.SetBasicAuth(s.metadata.username, s.metadata.password) + req.Header.Set("Origin", s.metadata.corsHeader) + resp, err := client.Do(req) if err != nil { return -1, err diff --git a/pkg/scalers/openstack/keystone_authentication.go b/pkg/scalers/openstack/keystone_authentication.go index 1d3684d32d6..4319d1a28e3 100644 --- a/pkg/scalers/openstack/keystone_authentication.go +++ b/pkg/scalers/openstack/keystone_authentication.go @@ -116,12 +116,11 @@ func (client *Client) IsTokenValid(ctx context.Context) (bool, error) { tokenURL.Path = path.Join(tokenURL.Path, tokensEndpoint) checkTokenRequest, err := http.NewRequestWithContext(ctx, "HEAD", tokenURL.String(), nil) - checkTokenRequest.Header.Set("X-Subject-Token", token) - checkTokenRequest.Header.Set("X-Auth-Token", token) - if err != nil { return false, err } + checkTokenRequest.Header.Set("X-Subject-Token", token) + checkTokenRequest.Header.Set("X-Auth-Token", token) response, err := client.HTTPClient.Do(checkTokenRequest)