diff --git a/modules/pulsepointBidAdapter.js b/modules/pulsepointBidAdapter.js
index 005eadaa390..f74d79a3dc5 100644
--- a/modules/pulsepointBidAdapter.js
+++ b/modules/pulsepointBidAdapter.js
@@ -121,10 +121,7 @@ function bidResponseAvailable(request, response) {
netRevenue: DEFAULT_NET_REVENUE,
currency: bidResponse.cur || DEFAULT_CURRENCY
};
- if (idToImpMap[id]['native']) {
- bid['native'] = nativeResponse(idToImpMap[id], idToBidMap[id]);
- bid.mediaType = 'native';
- } else if (idToImpMap[id].video) {
+ if (idToImpMap[id].video) {
// for outstream, a renderer is specified
if (idToSlotConfig[id] && utils.deepAccess(idToSlotConfig[id], 'mediaTypes.video.context') === 'outstream') {
bid.renderer = outstreamRenderer(utils.deepAccess(idToSlotConfig[id], 'renderer.options'), utils.deepAccess(idToBidMap[id], 'ext.outstream'));
@@ -133,10 +130,13 @@ function bidResponseAvailable(request, response) {
bid.mediaType = 'video';
bid.width = idToBidMap[id].w;
bid.height = idToBidMap[id].h;
- } else {
+ } else if (idToImpMap[id].banner) {
bid.ad = idToBidMap[id].adm;
bid.width = idToBidMap[id].w || idToImpMap[id].banner.w;
bid.height = idToBidMap[id].h || idToImpMap[id].banner.h;
+ } else if (idToImpMap[id]['native']) {
+ bid['native'] = nativeResponse(idToImpMap[id], idToBidMap[id]);
+ bid.mediaType = 'native';
}
bids.push(bid);
}
diff --git a/test/spec/modules/pulsepointBidAdapter_spec.js b/test/spec/modules/pulsepointBidAdapter_spec.js
index cf81a26eebb..c3830d5cb46 100644
--- a/test/spec/modules/pulsepointBidAdapter_spec.js
+++ b/test/spec/modules/pulsepointBidAdapter_spec.js
@@ -724,4 +724,58 @@ describe('PulsePoint Adapter Tests', function () {
expect(bid.width).to.equal(728);
expect(bid.height).to.equal(90);
});
+ it('Verify multi-format response', function () {
+ const bidRequests = deepClone(slotConfigs);
+ bidRequests[0].mediaTypes['native'] = {
+ title: {
+ required: true
+ },
+ image: {
+ required: true
+ },
+ sponsoredBy: {
+ required: true
+ }
+ };
+ bidRequests[1].params.video = {
+ w: 400,
+ h: 300,
+ minduration: 5,
+ maxduration: 10,
+ };
+ const request = spec.buildRequests(bidRequests, bidderRequest);
+ expect(request).to.be.not.null;
+ expect(request.data).to.be.not.null;
+ const ortbRequest = request.data;
+ expect(ortbRequest.imp).to.have.lengthOf(2);
+ // adsize on response
+ const ortbResponse = {
+ seatbid: [{
+ bid: [{
+ impid: ortbRequest.imp[0].id,
+ price: 1.25,
+ adm: 'This is an Ad',
+ crid: 'Creative#123',
+ w: 728,
+ h: 90
+ }, {
+ impid: ortbRequest.imp[1].id,
+ price: 2.5,
+ adm: '',
+ crid: 'Creative#234',
+ w: 728,
+ h: 90
+ }]
+ }]
+ };
+ // request has both types - banner and native, response is parsed as banner.
+ // for impression#2, response is parsed as video
+ const bids = spec.interpretResponse({ body: ortbResponse }, request);
+ expect(bids).to.have.lengthOf(2);
+ const bid = bids[0];
+ expect(bid.width).to.equal(728);
+ expect(bid.height).to.equal(90);
+ const secondBid = bids[1];
+ expect(secondBid.vastXml).to.equal('');
+ });
});