Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openxOrtb bid adapter: support 204 response, small bug fix #8796

Merged
merged 1 commit into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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