Skip to content

Commit

Permalink
implement issue prebid#5687 (prebid#5716)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrmartinez authored and BrightMountainMedia committed Sep 14, 2020
1 parent 100a364 commit c9f52b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ const OPEN_RTB_PROTOCOL = {
// Don't push oustream w/o renderer to request object.
utils.logError('Outstream bid without renderer cannot be sent to Prebid Server.');
} else {
if (videoParams.context === 'instream' && !videoParams.hasOwnProperty('placement')) {
videoParams.placement = 1;
}
mediaTypes['video'] = videoParams;
}
}
Expand Down
16 changes: 16 additions & 0 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,22 @@ describe('S2S Adapter', function () {
expect(requestBid.imp[0].video).to.not.exist;
});

it('should default video placement if not defined and instream', function () {
let ortb2Config = utils.deepClone(CONFIG);
ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction';

config.setConfig({ s2sConfig: ortb2Config });

let videoBid = utils.deepClone(VIDEO_REQUEST);
videoBid.ad_units[0].mediaTypes.video.context = 'instream';
adapter.callBids(videoBid, BID_REQUESTS, addBidResponse, done, ajax);

const requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.imp[0].banner).to.not.exist;
expect(requestBid.imp[0].video).to.exist;
expect(requestBid.imp[0].video.placement).to.equal(1);
});

it('exists and is a function', function () {
expect(adapter.callBids).to.exist.and.to.be.a('function');
});
Expand Down

0 comments on commit c9f52b7

Please sign in to comment.