Skip to content

Commit

Permalink
Revert "fix GPT Pre-Auction PBS path (prebid#5650)"
Browse files Browse the repository at this point in the history
This reverts commit e4838b2.
  • Loading branch information
BrightMountainMedia authored Sep 14, 2020
1 parent 4394459 commit d7d267b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 32 deletions.
14 changes: 6 additions & 8 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,15 +551,13 @@ const OPEN_RTB_PROTOCOL = {
}

/**
* Copy GAM AdUnit and Name to imp
* GAM Ad Unit
* @type {(string|undefined)}
*/
['name', 'adSlot'].forEach(name => {
/** @type {(string|undefined)} */
const value = utils.deepAccess(adUnit, `fpd.context.adserver.${name}`);
if (typeof value === 'string' && value) {
utils.deepSetValue(imp, `ext.context.data.adserver.${name.toLowerCase()}`, value);
}
});
const gamAdUnit = utils.deepAccess(adUnit, 'fpd.context.adServer.adSlot');
if (typeof gamAdUnit === 'string' && gamAdUnit) {
utils.deepSetValue(imp, 'ext.context.data.adslot', gamAdUnit);
}

Object.assign(imp, mediaTypes);

Expand Down
14 changes: 6 additions & 8 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,13 @@ export const spec = {
}

/**
* Copy GAM AdUnit and Name to imp
* GAM Ad Unit
* @type {(string|undefined)}
*/
['name', 'adSlot'].forEach(name => {
/** @type {(string|undefined)} */
const value = utils.deepAccess(bidRequest, `fpd.context.adserver.${name}`);
if (typeof value === 'string' && value) {
utils.deepSetValue(data.imp[0].ext, `context.data.adserver.${name.toLowerCase()}`, value);
}
});
const gamAdUnit = utils.deepAccess(bidRequest, 'fpd.context.adServer.adSlot');
if (typeof gamAdUnit === 'string' && gamAdUnit) {
utils.deepSetValue(data.imp[0].ext, 'context.data.adslot', gamAdUnit);
}

// if storedAuctionResponse has been set, pass SRID
if (bidRequest.storedAuctionResponse) {
Expand Down
19 changes: 8 additions & 11 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ describe('S2S Adapter', function () {
});

describe('GAM ad unit config', function () {
it('should not send \"imp.ext.context.data.adserver.adslot\" if \"fpd.context\" is undefined', function () {
it('should not send \"imp.ext.context.data.adslot\" if \"fpd.context\" is undefined', function () {
const ortb2Config = utils.deepClone(CONFIG);
ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction';
const consentConfig = { s2sConfig: ortb2Config };
Expand All @@ -1531,7 +1531,7 @@ describe('S2S Adapter', function () {
expect(parsedRequestBody.imp[0]).to.not.have.deep.nested.property('ext.context.data.adslot');
});

it('should not send \"imp.ext.context.data.adserver.adslot\" if \"fpd.context.adserver.adSlot\" is undefined', function () {
it('should not send \"imp.ext.context.data.adslot\" if \"fpd.context.adServer.adSlot\" is undefined', function () {
const ortb2Config = utils.deepClone(CONFIG);
ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction';
const consentConfig = { s2sConfig: ortb2Config };
Expand All @@ -1547,7 +1547,7 @@ describe('S2S Adapter', function () {
expect(parsedRequestBody.imp[0]).to.not.have.deep.nested.property('ext.context.data.adslot');
});

it('should not send \"imp.ext.context.data.adserver.adslot\" if \"fpd.context.adserver.adSlot\" is empty string', function () {
it('should not send \"imp.ext.context.data.adslot\" if \"fpd.context.adServer.adSlot\" is empty string', function () {
const ortb2Config = utils.deepClone(CONFIG);
ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction';
const consentConfig = { s2sConfig: ortb2Config };
Expand All @@ -1569,17 +1569,16 @@ describe('S2S Adapter', function () {
expect(parsedRequestBody.imp[0]).to.not.have.deep.nested.property('ext.context.data.adslot');
});

it('should send both \"adslot\" and \"name\" from \"imp.ext.context.data.adserver\" if \"fpd.context.adserver.adSlot\" and \"fpd.context.adserver.name\" values are non-empty strings', function () {
it('should send \"imp.ext.context.data.adslot\" if \"fpd.context.adServer.adSlot\" value is a non-empty string', function () {
const ortb2Config = utils.deepClone(CONFIG);
ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction';
const consentConfig = { s2sConfig: ortb2Config };
config.setConfig(consentConfig);
const bidRequest = utils.deepClone(REQUEST);
bidRequest.ad_units[0].fpd = {
context: {
adserver: {
adSlot: '/a/b/c',
name: 'adserverName1'
adServer: {
adSlot: '/a/b/c'
}
}
};
Expand All @@ -1589,10 +1588,8 @@ describe('S2S Adapter', function () {

expect(parsedRequestBody.imp).to.be.a('array');
expect(parsedRequestBody.imp[0]).to.be.a('object');
expect(parsedRequestBody.imp[0]).to.have.deep.nested.property('ext.context.data.adserver.adslot');
expect(parsedRequestBody.imp[0]).to.have.deep.nested.property('ext.context.data.adserver.name');
expect(parsedRequestBody.imp[0].ext.context.data.adserver.adslot).to.equal('/a/b/c');
expect(parsedRequestBody.imp[0].ext.context.data.adserver.name).to.equal('adserverName1');
expect(parsedRequestBody.imp[0]).to.have.deep.nested.property('ext.context.data.adslot');
expect(parsedRequestBody.imp[0].ext.context.data.adslot).to.equal('/a/b/c');
});
});
});
Expand Down
8 changes: 3 additions & 5 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2037,9 +2037,8 @@ describe('the rubicon adapter', function () {
createVideoBidderRequest();
bidderRequest.bids[0].fpd = {
context: {
adserver: {
adSlot: '1234567890',
name: 'adServerName1'
adServer: {
adSlot: '1234567890'
}
}
};
Expand All @@ -2049,8 +2048,7 @@ describe('the rubicon adapter', function () {
);

const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
expect(request.data.imp[0].ext.context.data.adserver.adslot).to.equal('1234567890');
expect(request.data.imp[0].ext.context.data.adserver.name).to.equal('adServerName1');
expect(request.data.imp[0].ext.context.data.adslot).to.equal('1234567890');
});

it('should use the integration type provided in the config instead of the default', () => {
Expand Down

0 comments on commit d7d267b

Please sign in to comment.