Skip to content

Commit fbb0109

Browse files
committed
Handle additional body-params formats.
Treat JSON-strings as objects. Don't crash on empty/undefined data.
1 parent 145797d commit fbb0109

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/gmail.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,8 +1015,12 @@ var Gmail = function(localJQuery) {
10151015
if(typeof params.body === "object") {
10161016
params.body_params = params.body;
10171017
params.body_is_object = true;
1018-
} else {
1018+
} else if (typeof params.body === "string" && params.body.indexOf("{") === 0){
1019+
params.body_params = JSON.parse(params.body);
1020+
} else if (params.body !== undefined) {
10191021
params.body_params = api.tools.deparam(params.body);
1022+
} else {
1023+
params.body_params = {};
10201024
}
10211025

10221026
if(typeof api.tracker.events !== "object" && typeof api.tracker.actions !== "object") {

0 commit comments

Comments
 (0)