diff --git a/modules/relaidoBidAdapter.js b/modules/relaidoBidAdapter.js index 128fd72996b..d3e3e10c507 100644 --- a/modules/relaidoBidAdapter.js +++ b/modules/relaidoBidAdapter.js @@ -121,9 +121,8 @@ function interpretResponse(serverResponse, bidRequest) { return []; } - const playerUrl = bidRequest.player || body.playerUrl; - for (const res of body.ads) { + const playerUrl = res.playerUrl || bidRequest.player || body.playerUrl; let bidResponse = { requestId: res.bidId, width: res.width, @@ -131,6 +130,7 @@ function interpretResponse(serverResponse, bidRequest) { cpm: res.price, currency: res.currency, creativeId: res.creativeId, + playerUrl: playerUrl, dealId: body.dealId || '', ttl: body.ttl || DEFAULT_TTL, netRevenue: true, diff --git a/test/spec/modules/relaidoBidAdapter_spec.js b/test/spec/modules/relaidoBidAdapter_spec.js index 51850e5f357..f0d381ee3ed 100644 --- a/test/spec/modules/relaidoBidAdapter_spec.js +++ b/test/spec/modules/relaidoBidAdapter_spec.js @@ -303,6 +303,7 @@ describe('RelaidoAdapter', function () { expect(response.currency).to.equal(serverResponse.body.ads[0].currency); expect(response.creativeId).to.equal(serverResponse.body.ads[0].creativeId); expect(response.vastXml).to.equal(serverResponse.body.ads[0].vast); + expect(response.playerUrl).to.equal(serverResponse.body.playerUrl); expect(response.meta.advertiserDomains).to.equal(serverResponse.body.ads[0].adomain); expect(response.meta.mediaType).to.equal(VIDEO); expect(response.ad).to.be.undefined; @@ -320,11 +321,29 @@ describe('RelaidoAdapter', function () { expect(response.currency).to.equal(serverResponse.body.ads[0].currency); expect(response.creativeId).to.equal(serverResponse.body.ads[0].creativeId); expect(response.vastXml).to.be.undefined; + expect(response.playerUrl).to.equal(serverResponse.body.playerUrl); expect(response.ad).to.include(`
`); expect(response.ad).to.include(``); expect(response.ad).to.include(`window.RelaidoPlayer.renderAd`); }); + it('should build bid response by video and playerUrl in ads', function () { + serverResponse.body.ads[0].playerUrl = 'https://relaido/player-customized.js'; + const bidResponses = spec.interpretResponse(serverResponse, serverRequest); + expect(bidResponses).to.have.lengthOf(1); + const response = bidResponses[0]; + expect(response.playerUrl).to.equal(serverResponse.body.ads[0].playerUrl); + }); + + it('should build bid response by banner and playerUrl in ads', function () { + serverResponse.body.ads[0].playerUrl = 'https://relaido/player-customized.js'; + serverResponse.body.ads[0].mediaType = 'banner'; + const bidResponses = spec.interpretResponse(serverResponse, serverRequest); + expect(bidResponses).to.have.lengthOf(1); + const response = bidResponses[0]; + expect(response.playerUrl).to.equal(serverResponse.body.ads[0].playerUrl); + }); + it('should not build bid response', function () { serverResponse = {}; const bidResponses = spec.interpretResponse(serverResponse, serverRequest);