diff --git a/modules/zeta_global_sspBidAdapter.js b/modules/zeta_global_sspBidAdapter.js index 295108f31b4..af73865c484 100644 --- a/modules/zeta_global_sspBidAdapter.js +++ b/modules/zeta_global_sspBidAdapter.js @@ -381,6 +381,10 @@ function provideMediaType(zetaBid, bid, bidRequest) { function clearEmpties(o) { for (let k in o) { + if (o[k] === null) { + delete o[k]; + continue; + } if (!o[k] || typeof o[k] !== 'object') { continue; } diff --git a/test/spec/modules/zeta_global_sspBidAdapter_spec.js b/test/spec/modules/zeta_global_sspBidAdapter_spec.js index b06a6700ebf..81617b93d3c 100644 --- a/test/spec/modules/zeta_global_sspBidAdapter_spec.js +++ b/test/spec/modules/zeta_global_sspBidAdapter_spec.js @@ -49,6 +49,12 @@ describe('Zeta Ssp Bid Adapter', function () { }, tags: { someTag: 444, + emptyTag: {}, + nullTag: null, + complexEmptyTag: { + empty: {}, + nullValue: null + } }, sid: 'publisherId', tagid: 'test_tag_id', @@ -657,4 +663,15 @@ describe('Zeta Ssp Bid Adapter', function () { expect(payload.device.w).to.not.be.undefined; expect(payload.device.h).to.not.be.undefined; }); + + it('Test that all empties are removed', function () { + const request = spec.buildRequests(bannerRequest, bannerRequest[0]); + const payload = JSON.parse(request.data); + + expect(payload.ext.tags.someTag).to.eql(444); + + expect(payload.ext.tags.emptyTag).to.be.undefined; + expect(payload.ext.tags.nullTag).to.be.undefined; + expect(payload.ext.tags.complexEmptyTag).to.be.undefined; + }); });