Skip to content

Commit

Permalink
PBS Bid Adapter: alias Fix (prebid#9100)
Browse files Browse the repository at this point in the history
* Added adjustment for aliasing unregistered bidders for server-side

* removed import
  • Loading branch information
Ryan Schweitzer authored and JacobKlein26 committed Feb 8, 2023
1 parent be5d9fb commit ed4c5d6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ Object.assign(ORTB2.prototype, {
const bidder = adapterManager.bidderRegistry[bid.bidder];
// adding alias only if alias source bidder exists and alias isn't configured to be standalone
// pbs adapter
if (bidder && !bidder.getSpec().skipPbsAliasing) {
if (!bidder || !bidder.getSpec().skipPbsAliasing) {
aliases[bid.bidder] = adapterManager.aliasRegistry[bid.bidder];
}
}
Expand Down
24 changes: 24 additions & 0 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,30 @@ describe('S2S Adapter', function () {
});
});

it('unregistered bidder should alias', function () {
const adjustedConfig = utils.deepClone(CONFIG);
adjustedConfig.bidders = 'bidderD'
config.setConfig({ s2sConfig: adjustedConfig });

const aliasBidder = {
bidder: 'bidderD',
params: {
unit: '10433394',
}
};

$$PREBID_GLOBAL$$.aliasBidder('mockBidder', aliasBidder.bidder);

const request = utils.deepClone(REQUEST);
request.ad_units[0].bids = [aliasBidder];
request.s2sConfig = adjustedConfig;

adapter.callBids(request, BID_REQUESTS, addBidResponse, done, ajax);

const requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.ext.prebid.aliases).to.deep.equal({ bidderD: 'mockBidder' });
});

it('adds dynamic aliases to request', function () {
config.setConfig({ s2sConfig: CONFIG });

Expand Down

0 comments on commit ed4c5d6

Please sign in to comment.