From b1d4679377f49b481d4ff00f48a1404bde2fb92a Mon Sep 17 00:00:00 2001 From: Justas Pupelis Date: Wed, 20 Mar 2024 18:59:48 +0200 Subject: [PATCH] Adf Bid Adapter: set vastUrl (#11243) * Set vastUrl on adfBidAdapter if bidResponse has nurl * mistype --- modules/adfBidAdapter.js | 9 ++++++++- test/spec/modules/adfBidAdapter_spec.js | 26 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/modules/adfBidAdapter.js b/modules/adfBidAdapter.js index 0484c383762..881b1adfcc4 100644 --- a/modules/adfBidAdapter.js +++ b/modules/adfBidAdapter.js @@ -230,7 +230,14 @@ export const spec = { ortb: bidResponse.native }; } else { - result[ mediaType === VIDEO ? 'vastXml' : 'ad' ] = bidResponse.adm; + if (mediaType === VIDEO) { + result.vastXml = bidResponse.adm; + if (bidResponse.nurl) { + result.vastUrl = bidResponse.nurl; + } + } else { + result.ad = bidResponse.adm; + } } if (!bid.renderer && mediaType === VIDEO && deepAccess(bid, 'mediaTypes.video.context') === 'outstream') { diff --git a/test/spec/modules/adfBidAdapter_spec.js b/test/spec/modules/adfBidAdapter_spec.js index 5612af8094c..d4c5f5c3c38 100644 --- a/test/spec/modules/adfBidAdapter_spec.js +++ b/test/spec/modules/adfBidAdapter_spec.js @@ -1321,6 +1321,32 @@ describe('Adf adapter', function () { assert.equal(bids[0].meta.mediaType, 'video'); }); + it('should set vastUrl if nurl is present in response', function () { + let vastUrl = 'http://url.to/vast' + let serverResponse = { + body: { + seatbid: [{ + bid: [{ impid: '1', adm: '', nurl: vastUrl, ext: { prebid: { type: 'video' } } }] + }] + } + }; + let bidRequest = { + data: {}, + bids: [ + { + bidId: 'bidId1', + params: { mid: 1000 } + } + ] + }; + + bids = spec.interpretResponse(serverResponse, bidRequest); + assert.equal(bids.length, 1); + assert.equal(bids[0].vastUrl, vastUrl); + assert.equal(bids[0].mediaType, 'video'); + assert.equal(bids[0].meta.mediaType, 'video'); + }); + it('should add renderer for outstream bids', function () { let serverResponse = { body: {