Skip to content

Commit ac7d813

Browse files
ialexAlejandro Villanueva
authored andcommitted
UPDATE setOrtb user ids to avoid passing an empty array when no user ids present (prebid#9875)
Co-authored-by: Alejandro Villanueva <[email protected]>
1 parent f8fb2fa commit ac7d813

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

modules/userId/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ module('userId', attachIdSystem);
10851085

10861086
export function setOrtbUserExtEids(ortbRequest, bidderRequest, context) {
10871087
const eids = deepAccess(context, 'bidRequests.0.userIdAsEids');
1088-
if (eids) {
1088+
if (eids && Object.keys(eids).length > 0) {
10891089
deepSetValue(ortbRequest, 'user.ext.eids', eids);
10901090
}
10911091
}

test/spec/ortbConverter/userId_spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,16 @@ describe('pbjs - ortb user eids', () => {
1818
setOrtbUserExtEids(req, {}, [{}]);
1919
expect(req).to.eql({});
2020
})
21+
22+
it('has no effect if user.ext.eids is an empty array', () => {
23+
const req = {};
24+
setOrtbUserExtEids(req, {}, {
25+
bidRequests: [
26+
{
27+
userIdAsEids: []
28+
}
29+
]
30+
});
31+
expect(req).to.eql({});
32+
});
2133
})

0 commit comments

Comments
 (0)