Skip to content

Commit

Permalink
openxOrtb support 204 response, small bug fix (#8796)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwschmidt authored Aug 7, 2022
1 parent 81a9e50 commit dd3267d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
6 changes: 5 additions & 1 deletion modules/openxOrtbBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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');
}

Expand Down
33 changes: 32 additions & 1 deletion test/spec/modules/openxOrtbBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [{
Expand Down Expand Up @@ -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 = [{
Expand Down

0 comments on commit dd3267d

Please sign in to comment.