Skip to content
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

Prebid Server Bid Adapter: add support for all imp parameters #8159

Merged
merged 5 commits into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ Object.assign(ORTB2.prototype, {
return acc;
}, {...deepAccess(adUnit, 'ortb2Imp.ext')});

const imp = { id: impressionId, ext, secure: s2sConfig.secure };
const imp = { ...adUnit.ortb2Imp, id: impressionId, ext, secure: s2sConfig.secure };

const ortb2 = {...deepAccess(adUnit, 'ortb2Imp.ext.data')};
Object.keys(ortb2).forEach(prop => {
Expand Down Expand Up @@ -745,7 +745,7 @@ Object.assign(ORTB2.prototype, {
}
});

Object.assign(imp, mediaTypes);
mergeDeep(imp, mediaTypes);

// if storedAuctionResponse has been set, pass SRID
const storedAuctionResponseBid = find(firstBidRequest.bids, bid => (bid.adUnitCode === adUnit.code && bid.storedAuctionResponse));
Expand Down
19 changes: 19 additions & 0 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2910,6 +2910,25 @@ describe('S2S Adapter', function () {
expect(requestBid.coopSync).to.be.undefined;
});

it('should set imp banner if ortb2Imp.banner is present', function() {
const consentConfig = { s2sConfig: CONFIG };
config.setConfig(consentConfig);
const bidRequest = utils.deepClone(REQUEST);
bidRequest.ad_units[0].ortb2Imp = {
banner: {
api: 7
}
};

adapter.callBids(bidRequest, BID_REQUESTS, addBidResponse, done, ajax);
const parsedRequestBody = JSON.parse(server.requests[0].requestBody);

expect(parsedRequestBody.imp).to.be.a('array');
expect(parsedRequestBody.imp[0]).to.be.a('object');
expect(parsedRequestBody.imp[0]).to.have.property('banner');
expect(parsedRequestBody.imp[0].banner.api).to.equal(7);
patmmccann marked this conversation as resolved.
Show resolved Hide resolved
});

it('adds debug flag', function () {
config.setConfig({debug: true});

Expand Down