Skip to content

Commit

Permalink
Consumable Bid Adapter: add language to request (#11722)
Browse files Browse the repository at this point in the history
* consumableBidAdapter: add language param

* consumableBidAdapter: add language param test

* consumableBidAdapter: get lang from bidderRequest
  • Loading branch information
jpiros authored Jun 6, 2024
1 parent 03d7059 commit 3002377
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/consumableBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export const spec = {
source: [{
'name': 'prebidjs',
'version': '$prebid.version$'
}]
}],
lang: bidderRequest.ortb2.device.language,
}, validBidRequests[0].params);

if (bidderRequest && bidderRequest.gdprConsent) {
Expand Down
26 changes: 26 additions & 0 deletions test/spec/modules/consumableBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ const BIDDER_REQUEST_1 = {
'http://example.com/iframe1.html',
'http://example.com/iframe2.html'
]
},
ortb2: {
device: {
language: 'en'
}
}
};

Expand Down Expand Up @@ -130,6 +135,11 @@ const BIDDER_REQUEST_2 = {
'http://example.com/iframe1.html',
'http://example.com/iframe2.html'
]
},
ortb2: {
device: {
language: 'en'
}
}
};

Expand Down Expand Up @@ -177,6 +187,11 @@ const BIDDER_REQUEST_VIDEO = {
'http://example.com/iframe1.html',
'http://example.com/iframe2.html'
]
},
ortb2: {
device: {
language: 'en'
}
}
};

Expand All @@ -188,6 +203,11 @@ const BIDDER_REQUEST_EMPTY = {
gdprConsent: {
consentString: 'consent-test',
gdprApplies: false
},
ortb2: {
device: {
language: 'en'
}
}
};

Expand Down Expand Up @@ -519,6 +539,12 @@ describe('Consumable BidAdapter', function () {
expect(data1.placements[0].bidfloor).to.equal(0.05);
expect(data2.placements[0].bidfloor).to.equal(0.15);
});
it('should contain the language param', function () {
let request = spec.buildRequests(BIDDER_REQUEST_1.bidRequest, BIDDER_REQUEST_1);
let data = JSON.parse(request.data);

expect(data.lang).to.equal('en');
});
});
describe('interpretResponse validation', function () {
it('response should have valid bidderCode', function () {
Expand Down

0 comments on commit 3002377

Please sign in to comment.