Skip to content

Commit

Permalink
fix: Added some missing error checks (#3985)
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
JorTurFer authored Dec 8, 2022
1 parent 35e6b6b commit b37e98b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions pkg/scalers/artemis_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions pkg/scalers/openstack/keystone_authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit b37e98b

Please sign in to comment.