diff --git a/modules/prebidServerBidAdapter.js b/modules/prebidServerBidAdapter.js index dcebc14dfa8..0906a1a0b3d 100644 --- a/modules/prebidServerBidAdapter.js +++ b/modules/prebidServerBidAdapter.js @@ -105,7 +105,16 @@ function PrebidServer() { /* Prebid executes this function when the page asks to send out bid requests */ baseAdapter.callBids = function(bidRequest) { const isDebug = !!getConfig('debug'); - convertTypes(bidRequest.ad_units); + const adUnits = utils.cloneJson(bidRequest.ad_units); + adUnits.forEach(adUnit => { + let videoMediaType = utils.deepAccess(adUnit, 'mediaTypes.video'); + if (videoMediaType) { + // pbs expects a ad_unit.video attribute if the imp is video + adUnit.video = Object.assign({}, videoMediaType); + delete adUnit.mediaTypes.video; + } + }) + convertTypes(adUnits); let requestJson = { account_id: config.accountId, tid: bidRequest.tid, @@ -114,7 +123,7 @@ function PrebidServer() { secure: config.secure, url: utils.getTopWindowUrl(), prebid_version: '$prebid.version$', - ad_units: bidRequest.ad_units.filter(hasSizes), + ad_units: adUnits.filter(hasSizes), is_debug: isDebug };