Skip to content

Commit

Permalink
Fix issue with appnexusAst sending user object in the wrong place. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Kendall authored and Nate Cozi committed Feb 9, 2017
1 parent 7cbe60b commit 8f0a7a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/adapters/appnexusAst.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function AppnexusAstAdapter() {
baseAdapter.callBids = function(bidRequest) {
const bids = bidRequest.bids || [];
var member = 0;
let userObj;
const tags = bids
.filter(bid => valid(bid))
.map(bid => {
Expand Down Expand Up @@ -84,17 +85,17 @@ function AppnexusAstAdapter() {
}

if (bid.params.user) {
tag.user = {};
userObj = {};
Object.keys(bid.params.user)
.filter(param => USER_PARAMS.includes(param))
.forEach(param => tag.user[param] = bid.params.user[param]);
.forEach(param => userObj[param] = bid.params.user[param]);
}

return tag;
});

if (!utils.isEmpty(tags)) {
const payloadJson = {tags: [...tags]};
const payloadJson = {tags: [...tags], user: userObj};
if (member > 0) {
payloadJson.member_id = member;
}
Expand Down
2 changes: 1 addition & 1 deletion test/spec/adapters/appnexusAst_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('AppNexusAdapter', () => {

adapter.callBids(REQUEST);

const request = JSON.parse(requests[0].requestBody).tags[0];
const request = JSON.parse(requests[0].requestBody);
expect(request.user).to.exist;
expect(request.user).to.deep.equal({
external_uid: '123',
Expand Down

0 comments on commit 8f0a7a6

Please sign in to comment.