Skip to content

Consumable Bid Adapter: add language to request #11722

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

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
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: (navigator && navigator.language) ? navigator.language.split('-')[0] : ''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is already on your request object, no need to hit navigator

language: win.navigator.language.split('-').shift(),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to grab from the bidderRequest object

}, validBidRequests[0].params);

if (bidderRequest && bidderRequest.gdprConsent) {
Expand Down
6 changes: 6 additions & 0 deletions test/spec/modules/consumableBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,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.be.a('string');
});
});
describe('interpretResponse validation', function () {
it('response should have valid bidderCode', function () {
Expand Down