Skip to content

Commit

Permalink
Livewrapped adapter: Original ortb2 config was unintentionally modifi…
Browse files Browse the repository at this point in the history
…ed (#8368)

* Original ortb2 config was modified when both ortb2 config and eids were present

* Handle empty ortb2 config
  • Loading branch information
bjorn-lw authored May 4, 2022
1 parent 68a3c4e commit e1169ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/livewrappedBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const spec = {
var adRequests = bidRequests.map(bidToAdRequest);

if (eids) {
ortb2 = mergeDeep(ortb2 || {}, eids);
ortb2 = mergeDeep(mergeDeep({}, ortb2 || {}), eids);
}

const payload = {
Expand Down
4 changes: 3 additions & 1 deletion test/spec/modules/livewrappedBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -890,9 +890,10 @@ describe('Livewrapped adapter tests', function () {
sandbox.stub(storage, 'cookiesAreEnabled').callsFake(() => true);

let origGetConfig = config.getConfig;
let orgOrtb2 = {user: {ext: {prop: 'value'}}};
sandbox.stub(config, 'getConfig').callsFake(function (key) {
if (key === 'ortb2') {
return {user: {ext: {prop: 'value'}}};
return orgOrtb2;
}
return origGetConfig.apply(config, arguments);
});
Expand All @@ -914,6 +915,7 @@ describe('Livewrapped adapter tests', function () {
var expected = {user: {ext: {prop: 'value', eids: testbidRequest.bids[0].userIdAsEids}}}

expect(data.rtbData).to.deep.equal(expected);
expect(orgOrtb2).to.deep.equal({user: {ext: {prop: 'value'}}});
});

it('should send schain object if available', function() {
Expand Down

0 comments on commit e1169ec

Please sign in to comment.