Skip to content

Commit

Permalink
Scape prometheus scaler URL
Browse files Browse the repository at this point in the history
  • Loading branch information
axelsccp committed Oct 8, 2023
1 parent 0c1a4b5 commit 5d56c79
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pkg/scalers/prometheus_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"net/http"
url_pkg "net/url"
"strconv"
"strings"
"time"

"github.com/go-logr/logr"
Expand Down Expand Up @@ -279,11 +278,7 @@ func (s *prometheusScaler) ExecutePromQuery(ctx context.Context) (float64, error
}

for queryParameterKey, queryParameterValue := range s.metadata.queryParameters {
test := queryParameterValue[len(queryParameterValue)-1:]
if test == "?" || test == "&" {
queryParameterValue = strings.TrimSuffix(queryParameterValue, test)
}
url = fmt.Sprintf("%s&%s=%s", url, queryParameterKey, queryParameterValue)
url = url_pkg.QueryEscape(fmt.Sprintf("%s&%s=%s", url, queryParameterKey, queryParameterValue))
}

req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
Expand Down

0 comments on commit 5d56c79

Please sign in to comment.