Skip to content

Commit

Permalink
Fix endpoint for vtex ads
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Sep 20, 2024
1 parent 1c071b6 commit ab45080
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions services/external/weni/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,14 @@ func VtexSponsoredSearch(searchUrl string, productSearch string) ([]string, []*h
query.Add("locale", "pt-BR")
query.Add("hideUnavailableItems", "true")

urlAfter := strings.TrimSuffix(searchUrl, "/")
parsedURL, err := url.Parse(searchUrl)
if err != nil {
fmt.Println("Erro ao fazer parse da URL:", err)
return nil, nil, err
}
domain := parsedURL.Host

url_ := fmt.Sprintf("%s?%s", urlAfter, query.Encode())
url_ := fmt.Sprintf("http://%s/api/io/_v/api/intelligent-search/sponsored_products?%s", domain, query.Encode())

req, err := httpx.NewRequest("GET", url_, nil, nil)
if err != nil {
Expand Down

0 comments on commit ab45080

Please sign in to comment.