Skip to content

Commit

Permalink
Remove extra query parameter name when calling sources using the gene…
Browse files Browse the repository at this point in the history
…rated code (#323)

* Remove extra query parameter name when calling sources using the generated code
  • Loading branch information
dehort authored Jan 20, 2024
1 parent eb37841 commit 4cd96e1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions internal/api/connectors/sources/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import (
"context"
"fmt"
"net/http"
"net/url"
"playbook-dispatcher/internal/common/constants"
"playbook-dispatcher/internal/common/utils"
"strings"
"time"

"github.com/redhatinsights/platform-go-middlewares/request_id"
Expand Down Expand Up @@ -33,6 +35,21 @@ func NewSourcesClientWithHttpRequestDoer(cfg *viper.Viper, doer HttpRequestDoer)
req.Header.Set(constants.HeaderIdentity, identity)
}

originalUrl := req.URL.String()
if strings.Contains(originalUrl, "filter=filter[") {
// Remove the extra filter parameter name
correctedUrl := strings.Replace(req.URL.String(), "filter=", "", -1)

newUrl, err := url.Parse(correctedUrl)
if err != nil {
return err
}

req.URL = newUrl
}

fmt.Println("sources url:", req.URL)

return nil
},
},
Expand Down

0 comments on commit 4cd96e1

Please sign in to comment.