Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extra query parameter name when calling sources using the generated code #323

Merged
merged 3 commits into from
Jan 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading