From 51d032d24fe10d85051798370cd73ca5d9c89b97 Mon Sep 17 00:00:00 2001 From: Ankit Pinge Date: Sat, 30 Sep 2023 16:43:58 +0530 Subject: [PATCH] Addressed some minor code fix --- adapters/vastbidder/bidder_macro.go | 7 +++---- adapters/vastbidder/bidder_macro_test.go | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/adapters/vastbidder/bidder_macro.go b/adapters/vastbidder/bidder_macro.go index 893847f3e0e..a88c8845027 100644 --- a/adapters/vastbidder/bidder_macro.go +++ b/adapters/vastbidder/bidder_macro.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "net/http" - "net/url" "strconv" "strings" "time" @@ -1211,11 +1210,11 @@ func (tag *BidderMacro) MacroKV(key string) string { return "" } - values := url.Values{} + keyval := "" for key, val := range tag.KV { - values.Add(key, fmt.Sprintf("%v", val)) + keyval += fmt.Sprintf("%s=%v&", key, val) } - return values.Encode() + return strings.TrimSuffix(keyval, "&") } diff --git a/adapters/vastbidder/bidder_macro_test.go b/adapters/vastbidder/bidder_macro_test.go index 2a6ff9fe5de..e5f27dfc2be 100644 --- a/adapters/vastbidder/bidder_macro_test.go +++ b/adapters/vastbidder/bidder_macro_test.go @@ -1340,7 +1340,7 @@ func TestBidderMacroKV(t *testing.T) { "age": "22", }}, args: args{key: "kv"}, - want: "age=22&name=test", + want: "name=test&age=22", }, { name: "Valid_test_with_url", @@ -1350,7 +1350,7 @@ func TestBidderMacroKV(t *testing.T) { "url": "http://example.com?k1=v1&k2=v2", }}, args: args{key: "kv"}, - want: "age=22&name=test&url=http%3A%2F%2Fexample.com%3Fk1%3Dv1%26k2%3Dv2", + want: "name=test&age=22&url=http://example.com?k1=v1&k2=v2", }, { name: "Empty_KV_map",