Skip to content

Commit be08dc8

Browse files
asurovenko-zetasurovenkoAlexey Surovenko
authored
Zeta Global Ssp Adapter: remove null values from payload (prebid#11092)
* ZetaGlobalSsp: remove null values from payload * unit test --------- Co-authored-by: Surovenko Alexey <[email protected]> Co-authored-by: Alexey Surovenko <[email protected]>
1 parent 7995508 commit be08dc8

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

modules/zeta_global_sspBidAdapter.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ function provideMediaType(zetaBid, bid, bidRequest) {
381381

382382
function clearEmpties(o) {
383383
for (let k in o) {
384+
if (o[k] === null) {
385+
delete o[k];
386+
continue;
387+
}
384388
if (!o[k] || typeof o[k] !== 'object') {
385389
continue;
386390
}

test/spec/modules/zeta_global_sspBidAdapter_spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ describe('Zeta Ssp Bid Adapter', function () {
4949
},
5050
tags: {
5151
someTag: 444,
52+
emptyTag: {},
53+
nullTag: null,
54+
complexEmptyTag: {
55+
empty: {},
56+
nullValue: null
57+
}
5258
},
5359
sid: 'publisherId',
5460
tagid: 'test_tag_id',
@@ -657,4 +663,15 @@ describe('Zeta Ssp Bid Adapter', function () {
657663
expect(payload.device.w).to.not.be.undefined;
658664
expect(payload.device.h).to.not.be.undefined;
659665
});
666+
667+
it('Test that all empties are removed', function () {
668+
const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
669+
const payload = JSON.parse(request.data);
670+
671+
expect(payload.ext.tags.someTag).to.eql(444);
672+
673+
expect(payload.ext.tags.emptyTag).to.be.undefined;
674+
expect(payload.ext.tags.nullTag).to.be.undefined;
675+
expect(payload.ext.tags.complexEmptyTag).to.be.undefined;
676+
});
660677
});

0 commit comments

Comments
 (0)