-
Notifications
You must be signed in to change notification settings - Fork 755
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
Make user.ext.prebid.buyeruids bidder name case insensitive #3152
Changes from 6 commits
2494d02
058b0ff
3f609e3
3f672c9
07427d6
b43a4cf
5c3a945
49a8d0e
033ae41
ddd182c
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 |
---|---|---|
|
@@ -1816,7 +1816,9 @@ func (deps *endpointDeps) validateUser(req *openrtb_ext.RequestWrapper, aliases | |
return append(errL, errors.New(`request.user.ext.prebid requires a "buyeruids" property with at least one ID defined. If none exist, then request.user.ext.prebid should not be defined.`)) | ||
} | ||
for bidderName := range prebid.BuyerUIDs { | ||
if _, ok := deps.bidderMap[bidderName]; !ok { | ||
normalizedCoreBidder, _ := openrtb_ext.NormalizeBidderName(bidderName) | ||
coreBidder := normalizedCoreBidder.String() | ||
if _, ok := deps.bidderMap[coreBidder]; !ok { | ||
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. Nitpick: in this PR here https://github.com/prebid/prebid-server/pull/3187/files#diff-785f5ab5ebde657757f3b3c34bf30a939782678d61bf1ea43f844c4f22a012d9R155:~:text=normalizeBidderName%20%20%20%20%20%20%20normalizeBidderName @SyntaxNode introduced a new function in endpoint deps. Other than this looks good, local testing looks good too. 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. Thank you, Veronika! Updated it in 49a8d0e |
||
if _, ok := aliases[bidderName]; !ok { | ||
return append(errL, fmt.Errorf("request.user.ext.%s is neither a known bidder name nor an alias in request.ext.prebid.aliases", bidderName)) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"description": "Amp request where root.user.ext.prebid.buyeruids field makes use of alias defined in root.ext.prebid.aliases and request makes use of case sensitive bidder name", | ||
"query": "tag_id=101", | ||
"config": { | ||
"mockBidders": [ | ||
{ | ||
"bidderName": "appnexus", | ||
"currency": "USD", | ||
"price": 2 | ||
} | ||
] | ||
}, | ||
"mockBidRequest": { | ||
"id": "request-with-user-ext-obj", | ||
"site": { | ||
"page": "test.somepage.com" | ||
}, | ||
"imp": [ | ||
{ | ||
"id": "my-imp-id", | ||
"banner": { | ||
"format": [ | ||
{ | ||
"w": 300, | ||
"h": 600 | ||
} | ||
] | ||
}, | ||
"ext": { | ||
"prebid": { | ||
"bidder": { | ||
"Appnexus": { | ||
"placementId": 12883451 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"user": { | ||
"ext": { | ||
"prebid": { | ||
"buyeruids": { | ||
"unknown": "123" | ||
} | ||
} | ||
} | ||
}, | ||
"ext": { | ||
"prebid": { | ||
"aliases": { | ||
"unknown": "Appnexus" | ||
} | ||
} | ||
} | ||
}, | ||
"expectedAmpResponse": { | ||
"targeting": { | ||
"hb_bidder": "Appnexus", | ||
"hb_bidder_Appnexus": "Appnexus", | ||
"hb_cache_host": "www.pbcserver.com", | ||
"hb_cache_host_Appnex": "www.pbcserver.com", | ||
"hb_cache_id": "0", | ||
"hb_cache_id_Appnexus": "0", | ||
"hb_cache_path": "/pbcache/endpoint", | ||
"hb_cache_path_Appnex": "/pbcache/endpoint", | ||
"hb_pb": "2.00", | ||
"hb_pb_Appnexus": "2.00" | ||
}, | ||
"ortb2": { | ||
"ext": { | ||
"warnings": { | ||
"general": [ | ||
{ | ||
"code": 10002, | ||
"message": "debug turned off for account" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"expectedReturnCode": 200 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"description": "Amp request where root.user.ext.prebid.buyeruids field has camel case bidder name", | ||
"query": "tag_id=101", | ||
"config": { | ||
"mockBidders": [ | ||
{ | ||
"bidderName": "yahooAds", | ||
"currency": "USD", | ||
"price": 2 | ||
} | ||
] | ||
}, | ||
"mockBidRequest": { | ||
"id": "request-with-user-ext-obj", | ||
"site": { | ||
"page": "test.somepage.com" | ||
}, | ||
"imp": [ | ||
{ | ||
"id": "my-imp-id", | ||
"banner": { | ||
"format": [ | ||
{ | ||
"w": 300, | ||
"h": 600 | ||
} | ||
] | ||
}, | ||
"ext": { | ||
"prebid": { | ||
"bidder": { | ||
"YahooAds": { | ||
"placementId": 12883451 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"user": { | ||
"ext": { | ||
"prebid": { | ||
"buyeruids": { | ||
"YahooAds": "123" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"expectedAmpResponse": { | ||
"targeting": { | ||
"hb_bidder": "YahooAds", | ||
"hb_bidder_YahooAds": "YahooAds", | ||
"hb_cache_host": "www.pbcserver.com", | ||
"hb_cache_host_YahooA": "www.pbcserver.com", | ||
"hb_cache_id": "0", | ||
"hb_cache_id_YahooAds": "0", | ||
"hb_cache_path": "/pbcache/endpoint", | ||
"hb_cache_path_YahooA": "/pbcache/endpoint", | ||
"hb_pb": "2.00", | ||
"hb_pb_YahooAds": "2.00" | ||
}, | ||
"ortb2": { | ||
"ext": { | ||
"warnings": { | ||
"general": [ | ||
{ | ||
"code": 10002, | ||
"message": "debug turned off for account" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"expectedReturnCode": 200 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"description": "Amp request where root.user.ext.prebid.buyeruids field has case insensitive bidder name", | ||
"query": "tag_id=101", | ||
"config": { | ||
"mockBidders": [ | ||
{ | ||
"bidderName": "appnexus", | ||
"currency": "USD", | ||
"price": 2 | ||
} | ||
] | ||
}, | ||
"mockBidRequest": { | ||
"id": "request-with-user-ext-obj", | ||
"site": { | ||
"page": "test.somepage.com" | ||
}, | ||
"imp": [ | ||
{ | ||
"id": "my-imp-id", | ||
"banner": { | ||
"format": [ | ||
{ | ||
"w": 300, | ||
"h": 600 | ||
} | ||
] | ||
}, | ||
"ext": { | ||
"prebid": { | ||
"bidder": { | ||
"Appnexus": { | ||
"placementId": 12883451 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"user": { | ||
"ext": { | ||
"prebid": { | ||
"buyeruids": { | ||
"Appnexus": "123" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"expectedAmpResponse": { | ||
"targeting": { | ||
"hb_bidder": "Appnexus", | ||
"hb_bidder_Appnexus": "Appnexus", | ||
"hb_cache_host": "www.pbcserver.com", | ||
"hb_cache_host_Appnex": "www.pbcserver.com", | ||
"hb_cache_id": "0", | ||
"hb_cache_id_Appnexus": "0", | ||
"hb_cache_path": "/pbcache/endpoint", | ||
"hb_cache_path_Appnex": "/pbcache/endpoint", | ||
"hb_pb": "2.00", | ||
"hb_pb_Appnexus": "2.00" | ||
}, | ||
"ortb2": { | ||
"ext": { | ||
"warnings": { | ||
"general": [ | ||
{ | ||
"code": 10002, | ||
"message": "debug turned off for account" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"expectedReturnCode": 200 | ||
} |
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.
I see that you have two test case files that you added for this PR. Would it mean that it also needs to be added in this function?
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.
Good catch! Added it in 07427d6