diff --git a/modules/openxOrtbBidAdapter.js b/modules/openxOrtbBidAdapter.js index a7a8d53a624..bbe0e827b8e 100644 --- a/modules/openxOrtbBidAdapter.js +++ b/modules/openxOrtbBidAdapter.js @@ -252,6 +252,10 @@ function getFloor(bid, mediaType) { } function interpretResponse(resp, req) { + if (!resp.body) { + resp.body = {nbr: 0}; + } + // pass these from request to the responses for use in userSync if (req.data.ext) { if (req.data.ext.delDomain) { @@ -301,7 +305,7 @@ function interpretResponse(resp, req) { } if (respBody.ext && respBody.ext.paf) { - response.meta.paf = respBody.ext.paf; + response.meta.paf = Object.assign({}, respBody.ext.paf); response.meta.paf.content_id = utils.deepAccess(bid, 'ext.paf.content_id'); } diff --git a/test/spec/modules/openxOrtbBidAdapter_spec.js b/test/spec/modules/openxOrtbBidAdapter_spec.js index b3f63d9c23a..3fe9b627d04 100644 --- a/test/spec/modules/openxOrtbBidAdapter_spec.js +++ b/test/spec/modules/openxOrtbBidAdapter_spec.js @@ -952,7 +952,7 @@ describe('OpenxRtbAdapter', function () { let bidResponse; let bid; - context('when there is no response', function () { + context('when there is an nbr response', function () { let bids; beforeEach(function () { bidRequestConfigs = [{ @@ -983,6 +983,37 @@ describe('OpenxRtbAdapter', function () { }); }); + context('when there is no response', function () { + let bids; + beforeEach(function () { + bidRequestConfigs = [{ + bidder: 'openx', + params: { + unit: '12345678', + delDomain: 'test-del-domain' + }, + adUnitCode: 'adunit-code', + mediaTypes: { + banner: { + sizes: [[300, 250], [300, 600]], + }, + }, + bidId: 'test-bid-id', + bidderRequestId: 'test-bidder-request-id', + auctionId: 'test-auction-id' + }]; + + bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0]; + + bidResponse = ''; // Unknown error + bids = spec.interpretResponse({body: bidResponse}, bidRequest); + }); + + it('should not return any bids', function () { + expect(bids.length).to.equal(0); + }); + }); + context('when there is a response, the common response properties', function () { beforeEach(function () { bidRequestConfigs = [{