Skip to content

Commit 8eee15c

Browse files
authored
Drop supportCors user sync YAML config option (prebid#4682)
1 parent d21932f commit 8eee15c

14 files changed

Lines changed: 46 additions & 118 deletions

File tree

analytics/core.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ type CookieSyncBidder struct {
8282
}
8383

8484
type UsersyncInfo struct {
85-
URL string `json:"url,omitempty"`
86-
Type string `json:"type,omitempty"`
87-
SupportCORS bool `json:"supportCORS,omitempty"`
85+
URL string `json:"url,omitempty"`
86+
Type string `json:"type,omitempty"`
8887
}
8988

9089
// NotificationEvent object of a transaction at /event

config/bidderinfo.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ type Syncer struct {
127127
// ExternalURL is available as a macro to the RedirectURL template.
128128
ExternalURL string `yaml:"externalUrl" mapstructure:"external_url"`
129129

130-
// SupportCORS identifies if CORS is supported for the user syncing endpoints.
131-
SupportCORS *bool `yaml:"supportCors" mapstructure:"support_cors"`
132-
133130
// FormatOverride allows a bidder to override their callback type "b" for iframe, "i" for redirect
134131
FormatOverride string `yaml:"formatOverride" mapstructure:"format_override"`
135132

@@ -154,7 +151,6 @@ func (s *Syncer) Equal(other *Syncer) bool {
154151
s.IFrame.Equal(other.IFrame) &&
155152
s.Redirect.Equal(other.Redirect) &&
156153
s.ExternalURL == other.ExternalURL &&
157-
ptrutil.Equal(s.SupportCORS, other.SupportCORS) &&
158154
s.FormatOverride == other.FormatOverride &&
159155
ptrutil.Equal(s.Enabled, other.Enabled) &&
160156
s.SkipWhen.Equal(other.SkipWhen)
@@ -264,7 +260,6 @@ func (s *Syncer) Defined() bool {
264260
s.IFrame != nil ||
265261
s.Redirect != nil ||
266262
s.ExternalURL != "" ||
267-
s.SupportCORS != nil ||
268263
s.FormatOverride != "" ||
269264
s.SkipWhen != nil
270265
}
@@ -805,10 +800,6 @@ func (s *Syncer) Override(original *Syncer) *Syncer {
805800
copy.ExternalURL = s.ExternalURL
806801
}
807802

808-
if s.SupportCORS != nil {
809-
copy.SupportCORS = s.SupportCORS
810-
}
811-
812803
return &copy
813804
}
814805

config/bidderinfo_test.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ aliasOf: bidderA
7373
func TestLoadBidderInfoFromDisk(t *testing.T) {
7474
// should appear in result in mixed case
7575
bidder := "stroeerCore"
76-
trueValue := true
7776

7877
adapterConfigs := make(map[string]Adapter)
7978
adapterConfigs[strings.ToLower(bidder)] = Adapter{}
@@ -115,7 +114,6 @@ func TestLoadBidderInfoFromDisk(t *testing.T) {
115114
ExternalURL: "https://redirect.host",
116115
UserMacro: "#UID",
117116
},
118-
SupportCORS: &trueValue,
119117
},
120118
},
121119
}
@@ -1402,11 +1400,6 @@ func TestBidderInfoValidationNegative(t *testing.T) {
14021400
}
14031401

14041402
func TestSyncerOverride(t *testing.T) {
1405-
var (
1406-
trueValue = true
1407-
falseValue = false
1408-
)
1409-
14101403
testCases := []struct {
14111404
description string
14121405
givenOriginal *Syncer
@@ -1467,12 +1460,6 @@ func TestSyncerOverride(t *testing.T) {
14671460
givenOverride: &Syncer{ExternalURL: "override"},
14681461
expected: &Syncer{ExternalURL: "override"},
14691462
},
1470-
{
1471-
description: "Override SupportCORS",
1472-
givenOriginal: &Syncer{SupportCORS: &trueValue},
1473-
givenOverride: &Syncer{SupportCORS: &falseValue},
1474-
expected: &Syncer{SupportCORS: &falseValue},
1475-
},
14761463
{
14771464
description: "Override Partial - Other Fields Untouched",
14781465
givenOriginal: &Syncer{Key: "originalKey", ExternalURL: "originalExternalURL"},
@@ -1715,18 +1702,6 @@ func TestSyncerEqual(t *testing.T) {
17151702
},
17161703
expected: false,
17171704
},
1718-
{
1719-
name: "different-support-cors",
1720-
syncer1: &Syncer{
1721-
Key: "key",
1722-
SupportCORS: ptrutil.ToPtr(true),
1723-
},
1724-
syncer2: &Syncer{
1725-
Key: "key",
1726-
SupportCORS: ptrutil.ToPtr(false),
1727-
},
1728-
expected: false,
1729-
},
17301705
{
17311706
name: "different-format-override",
17321707
syncer1: &Syncer{
@@ -1782,7 +1757,6 @@ func TestSyncerEqual(t *testing.T) {
17821757
UserMacro: "$UID",
17831758
},
17841759
ExternalURL: "https://external.com",
1785-
SupportCORS: ptrutil.ToPtr(true),
17861760
FormatOverride: "i",
17871761
Enabled: ptrutil.ToPtr(true),
17881762
SkipWhen: &SkipWhen{
@@ -1803,7 +1777,6 @@ func TestSyncerEqual(t *testing.T) {
18031777
UserMacro: "$UID",
18041778
},
18051779
ExternalURL: "https://external.com",
1806-
SupportCORS: ptrutil.ToPtr(true),
18071780
FormatOverride: "i",
18081781
Enabled: ptrutil.ToPtr(true),
18091782
SkipWhen: &SkipWhen{
@@ -2073,11 +2046,6 @@ func TestSyncerDefined(t *testing.T) {
20732046
givenSyncer: &Syncer{ExternalURL: "anyURL"},
20742047
expected: true,
20752048
},
2076-
{
2077-
name: "supportscors-only",
2078-
givenSyncer: &Syncer{SupportCORS: ptrutil.ToPtr(false)},
2079-
expected: true,
2080-
},
20812049
{
20822050
name: "formatoverride-only",
20832051
givenSyncer: &Syncer{FormatOverride: "anyFormat"},

config/config_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,6 @@ func TestMigrateConfigFromEnv(t *testing.T) {
10231023
}
10241024

10251025
func TestUserSyncFromEnv(t *testing.T) {
1026-
truePtr := true
1027-
10281026
// setup env vars for testing
10291027
if oldval, ok := os.LookupEnv("PBS_ADAPTERS_BIDDER1_USERSYNC_REDIRECT_URL"); ok {
10301028
defer os.Setenv("PBS_ADAPTERS_BIDDER1_USERSYNC_REDIRECT_URL", oldval)
@@ -1061,11 +1059,9 @@ func TestUserSyncFromEnv(t *testing.T) {
10611059
assert.Equal(t, "http://some.url/sync?redirect={{.RedirectURL}}", cfg.BidderInfos["bidder1"].Syncer.Redirect.URL)
10621060
assert.Equal(t, "[UID]", cfg.BidderInfos["bidder1"].Syncer.Redirect.UserMacro)
10631061
assert.Nil(t, cfg.BidderInfos["bidder1"].Syncer.IFrame)
1064-
assert.Equal(t, &truePtr, cfg.BidderInfos["bidder1"].Syncer.SupportCORS)
10651062

10661063
assert.Equal(t, "http://somedifferent.url/sync?redirect={{.RedirectURL}}", cfg.BidderInfos["bidder2"].Syncer.IFrame.URL)
10671064
assert.Nil(t, cfg.BidderInfos["bidder2"].Syncer.Redirect)
1068-
assert.Nil(t, cfg.BidderInfos["bidder2"].Syncer.SupportCORS)
10691065
}
10701066

10711067
func TestBidderInfoFromEnv(t *testing.T) {

config/test/bidder-info-valid/stroeerCore.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ userSync:
2727
url: "https://foo.com/sync?mode=redirect&r={{.RedirectURL}}"
2828
redirectUrl: "{{.ExternalURL}}/setuid/redirect"
2929
externalUrl: "https://redirect.host"
30-
userMacro: "#UID"
31-
supportCors: true
30+
userMacro: "#UID"

endpoints/cookie_sync.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,8 @@ func (c *cookieSyncEndpoint) handleResponse(w http.ResponseWriter, tf usersync.S
466466
BidderCode: syncerChoice.Bidder,
467467
NoCookie: true,
468468
UsersyncInfo: cookieSyncResponseSync{
469-
URL: sync.URL,
470-
Type: string(sync.Type),
471-
SupportCORS: sync.SupportCORS,
469+
URL: sync.URL,
470+
Type: string(sync.Type),
472471
},
473472
})
474473
}
@@ -536,9 +535,8 @@ func mapBidderStatusToAnalytics(from []cookieSyncResponseBidder) []*analytics.Co
536535
BidderCode: b.BidderCode,
537536
NoCookie: b.NoCookie,
538537
UsersyncInfo: &analytics.UsersyncInfo{
539-
URL: b.UsersyncInfo.URL,
540-
Type: b.UsersyncInfo.Type,
541-
SupportCORS: b.UsersyncInfo.SupportCORS,
538+
URL: b.UsersyncInfo.URL,
539+
Type: b.UsersyncInfo.Type,
542540
},
543541
}
544542
}
@@ -604,9 +602,8 @@ type cookieSyncResponseBidder struct {
604602
}
605603

606604
type cookieSyncResponseSync struct {
607-
URL string `json:"url,omitempty"`
608-
Type string `json:"type,omitempty"`
609-
SupportCORS bool `json:"supportCORS,omitempty"`
605+
URL string `json:"url,omitempty"`
606+
Type string `json:"type,omitempty"`
610607
}
611608

612609
type cookieSyncResponseDebug struct {

0 commit comments

Comments
 (0)