-
Notifications
You must be signed in to change notification settings - Fork 769
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
Use bidder name instead of syncer key #2948
Changes from 1 commit
b7437bf
00a164f
8a34f81
fc8b684
c6a9bd5
6139a86
06e17ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,13 +39,6 @@ func NewSetUIDEndpoint(cfg *config.Configuration, syncersByBidder map[string]use | |
encoder := usersync.Base64Encoder{} | ||
decoder := usersync.Base64Decoder{} | ||
|
||
// convert map of syncers by bidder to map of syncers by key | ||
// - its safe to assume that if multiple bidders map to the same key, the syncers are interchangeable. | ||
syncersByKey := make(map[string]usersync.Syncer, len(syncersByBidder)) | ||
for _, v := range syncersByBidder { | ||
syncersByKey[v.Key()] = v | ||
} | ||
|
||
return httprouter.Handle(func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { | ||
so := analytics.SetUIDObject{ | ||
Status: http.StatusOK, | ||
|
@@ -65,7 +58,7 @@ func NewSetUIDEndpoint(cfg *config.Configuration, syncersByBidder map[string]use | |
|
||
query := r.URL.Query() | ||
|
||
syncer, err := getSyncer(query, syncersByKey) | ||
syncer, err := getSyncer(query, syncersByBidder) | ||
if err != nil { | ||
w.WriteHeader(http.StatusBadRequest) | ||
w.Write([]byte(err.Error())) | ||
|
@@ -313,14 +306,14 @@ func parseConsentFromGppStr(gppQueryValue string) (string, error) { | |
return gdprConsent, nil | ||
} | ||
|
||
func getSyncer(query url.Values, syncersByKey map[string]usersync.Syncer) (usersync.Syncer, error) { | ||
func getSyncer(query url.Values, syncersByBidder map[string]usersync.Syncer) (usersync.Syncer, error) { | ||
key := query.Get("bidder") | ||
|
||
if key == "" { | ||
return nil, errors.New(`"bidder" query param is required`) | ||
} | ||
|
||
syncer, syncerExists := syncersByKey[key] | ||
syncer, syncerExists := syncersByBidder[key] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this change is already present in this PR: #2897 (comment) |
||
if !syncerExists { | ||
return nil, errors.New("The bidder name provided is not supported by Prebid Server") | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assumption is still generally true, but the bidder name is now important for activity control so this approach is no longer valid.