Skip to content

Commit

Permalink
make user.ext.prebid.buyeruids bidder name case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonali-More-Xandr committed Sep 22, 2023
1 parent 6e3ba92 commit d1c1cb4
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
1 change: 1 addition & 0 deletions endpoints/openrtb2/amp_auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func TestGoodAmpRequests(t *testing.T) {
"imp-with-stored-resp.json",
"gdpr-no-consentstring.json",
"gdpr.json",
"aliased-buyeruids-case-insensitive.json",
},
},
{
Expand Down
4 changes: 3 additions & 1 deletion endpoints/openrtb2/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,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 {
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))
}
Expand Down
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
}

0 comments on commit d1c1cb4

Please sign in to comment.