Skip to content

Commit

Permalink
Bugfix: Issue 3111 (prebid#3122)
Browse files Browse the repository at this point in the history
* bug fix for Prebid issue 3111

* adding try-catch around the fix

* added a warning on exception handling

* updated the message

* using util.deepClone

* changed variable name from original_bid to originalBid

* unit test case for checking original object modification
  • Loading branch information
pm-harshad-mane authored and Pedro López Jiménez committed Mar 18, 2019
1 parent 1d304ea commit a1dd451
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/pubmaticBidAdapter.js
Expand Up @@ -373,7 +373,9 @@ export const spec = {
var dctr = '';
var dctrLen;
var dctrArr = [];
validBidRequests.forEach(bid => {
var bid;
validBidRequests.forEach(originalBid => {
bid = utils.deepClone(originalBid);
_parseAdSlot(bid);
if (bid.params.hasOwnProperty('video')) {
if (
Expand Down
8 changes: 7 additions & 1 deletion test/spec/modules/pubmaticBidAdapter_spec.js
Expand Up @@ -217,7 +217,13 @@ describe('PubMatic adapter', function () {
});

describe('Request formation', function () {
it('Endpoint checking', function () {
it('buildRequests function should not modify original bidRequests object', function () {
let originalBidRequests = utils.deepClone(bidRequests);
let request = spec.buildRequests(bidRequests);
expect(bidRequests).to.deep.equal(originalBidRequests);
});

it('Endpoint checking', function () {
let request = spec.buildRequests(bidRequests);
expect(request.url).to.equal('//hbopenbid.pubmatic.com/translator?source=prebid-client');
expect(request.method).to.equal('POST');
Expand Down

0 comments on commit a1dd451

Please sign in to comment.