Skip to content

Commit 757ff72

Browse files
gwhigsdgirardi
andauthored
Core: Skip module bids during mediaType eligibility checks (prebid#14058)
* Core: Skip module bids during mediaType eligibility checks Module bids do not have a `bidder` property. They should not be considered for mediaType checks. This only works as-is for banner units because we default `supportedMediaTypes` to `['banner']'` for an `undefined` bidder. Closes prebid#14057 * add test case --------- Co-authored-by: Demetrio Girardi <dgirardi@prebid.org>
1 parent 5a72ddd commit 757ff72

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/prebid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ export const startAuction = hook('async', function ({ bidsBackHandler, timeout:
850850
const adUnitMediaTypes = Object.keys(adUnit.mediaTypes || { 'banner': 'banner' });
851851

852852
// get the bidder's mediaTypes
853-
const allBidders = adUnit.bids.map(bid => bid.bidder);
853+
const allBidders = adUnit.bids.map(bid => bid.bidder).filter(Boolean);
854854
const bidderRegistry = adapterManager.bidderRegistry;
855855

856856
const bidders = allBidders.filter(bidder => !s2sBidders.has(bidder));

test/spec/unit/pbjs_api_spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,6 +2849,18 @@ describe('Unit: Prebid Module', function () {
28492849
// only appnexus supports native
28502850
expect(biddersCalled.length).to.equal(1);
28512851
});
2852+
2853+
it('module bids should not be filtered out', async () => {
2854+
delete adUnits[0].mediaTypes.banner;
2855+
adUnits[0].bids.push({
2856+
module: 'pbsBidAdapter',
2857+
ortb2Imp: {}
2858+
});
2859+
2860+
pbjs.requestBids({adUnits});
2861+
await auctionStarted;
2862+
expect(adapterManager.callBids.getCall(0).args[0][0].bids.length).to.eql(2);
2863+
})
28522864
});
28532865

28542866
describe('part 2', function () {

0 commit comments

Comments
 (0)