Skip to content

Commit

Permalink
fix: add check to remove null and undefined properties before sending (
Browse files Browse the repository at this point in the history
…#2796)

* fix: add check to remove null and undefined properties before sending

* chore: fix test
  • Loading branch information
yashasvibajpai authored Nov 6, 2023
1 parent 55f9637 commit 6e89cd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/v0/destinations/adobe_analytics/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {
isDefinedAndNotNull,
isDefinedAndNotNullAndNotEmpty,
getIntegrationsObj,
removeUndefinedAndNullValues,
simpleProcessRouterDest,
} = require('../../util');
const {
Expand Down Expand Up @@ -394,7 +395,7 @@ const handleTrack = (message, destinationConfig) => {
break;
}

return payload;
return removeUndefinedAndNullValues(payload);
};

const process = async (event) => {
Expand Down
4 changes: 2 additions & 2 deletions test/__tests__/data/adobe_analytics.json
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,6 @@
},
"messageId": "1578564113557-af022c68-429e-4af4-b99b-2b9174056383",
"properties": {
"order_id": "1234",
"affiliation": "Apple Store",
"value": 20,
"revenue": 15.0,
Expand All @@ -1019,6 +1018,7 @@
"discount": 1.5,
"coupon": "ImagePro",
"currency": "USD",
"purchaseId": "p101",
"products": [
{
"product_id": "123",
Expand Down Expand Up @@ -1205,7 +1205,7 @@
"JSON": {},
"JSON_ARRAY": {},
"XML": {
"payload": "<?xml version=\"1.0\" encoding=\"utf-8\"?><request><browserHeight>1794</browserHeight><browserWidth>1080</browserWidth><campaign>sales campaign</campaign><channel>web</channel><currencyCode>USD</currencyCode><ipaddress>127.0.0.1</ipaddress><language>en-US</language><purchaseID>1234</purchaseID><transactionID>1234</transactionID><userAgent>Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)</userAgent><referrer>https://www.google.com/search?q=estore+bestseller</referrer><contextData><roott01>roottval001</roott01></contextData><eVar6>RudderLabs JavaScript SDK</eVar6><linkType>o</linkType><linkName>checkout started</linkName><linkURL>https://www.estore.com/best-seller/1</linkURL><timestamp>2020-01-09T10:01:53.558Z</timestamp><marketingcloudorgid>mktcloudid001</marketingcloudorgid><events>scCheckout</events><products>Games;Monopoly;1;14.00,Games;UNO;2;6.90</products><reportSuiteID>footlockerrudderstackpoc</reportSuiteID></request>"
"payload": "<?xml version=\"1.0\" encoding=\"utf-8\"?><request><browserHeight>1794</browserHeight><browserWidth>1080</browserWidth><campaign>sales campaign</campaign><channel>web</channel><currencyCode>USD</currencyCode><ipaddress>127.0.0.1</ipaddress><language>en-US</language><userAgent>Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)</userAgent><referrer>https://www.google.com/search?q=estore+bestseller</referrer><contextData><roott01>roottval001</roott01></contextData><eVar6>RudderLabs JavaScript SDK</eVar6><linkType>o</linkType><linkName>checkout started</linkName><linkURL>https://www.estore.com/best-seller/1</linkURL><timestamp>2020-01-09T10:01:53.558Z</timestamp><marketingcloudorgid>mktcloudid001</marketingcloudorgid><purchaseID>p101</purchaseID><events>scCheckout</events><products>Games;Monopoly;1;14.00,Games;UNO;2;6.90</products><reportSuiteID>footlockerrudderstackpoc</reportSuiteID></request>"
},
"FORM": {}
},
Expand Down

0 comments on commit 6e89cd3

Please sign in to comment.