Skip to content

Commit

Permalink
fix(klaviyo): sending error field at root level for suppress events (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 committed Oct 11, 2023
1 parent 6e20a72 commit bc88f13
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 11 additions & 7 deletions src/v0/destinations/klaviyo/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,18 @@ const processRouterDest = async (inputs, reqMetadata) => {
message?.statusCode &&
message.statusCode === HTTP_STATUS_CODES.SUPPRESS_EVENTS
) {
const { error } = message;
delete message.error;
delete message.statusCode;
return getSuccessRespEvents(
message,
[metadata],
eventDestination,
false,
HTTP_STATUS_CODES.SUPPRESS_EVENTS,
);
return {
...getSuccessRespEvents(
message,
[metadata],
eventDestination,
false,
HTTP_STATUS_CODES.SUPPRESS_EVENTS,
), error
}
}
return getSuccessRespEvents(message, [metadata], eventDestination);
});
Expand Down
4 changes: 2 additions & 2 deletions test/__tests__/data/klaviyo_router.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@
"XML": {},
"FORM": {}
},
"files": {},
"error": "{\"id\":\"01GW3PHVY0MTCDGS0A1612HARX\",\"attributes\":{}}"
"files": {}
},
"error": "{\"id\":\"01GW3PHVY0MTCDGS0A1612HARX\",\"attributes\":{}}",
"metadata": [
{
"jobId": 1
Expand Down

0 comments on commit bc88f13

Please sign in to comment.