Skip to content

Commit 717f30c

Browse files
committed
serializing changed for the array
1 parent 2f6835d commit 717f30c

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

dist/react-native/contentstack.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,12 @@ function Request(options) {
901901
var serialize = function serialize(obj, prefix) {
902902
var str = [],
903903
p = void 0;
904-
for (p in obj) {
905-
if (obj.hasOwnProperty(p)) {
904+
if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" && obj.length !== undefined) {
905+
for (var i = 0, _i = obj.length; i < _i; i++) {
906+
str.push(prefix + '[]=' + obj[i]);
907+
}
908+
} else {
909+
for (p in obj) {
906910
var k = prefix ? prefix + "[" + p + "]" : p,
907911
v = obj[p];
908912
str.push(v !== null && (typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && p !== 'query' ? serialize(v, k) : k + "=" + (p !== 'query' ? encodeURIComponent(v) : JSON.stringify(v)));
@@ -920,6 +924,7 @@ function Request(options) {
920924

921925
if (options.body && _typeof(options.body) === 'object') {
922926
delete options.body._method;
927+
if (_typeof(options.body.query) === "object" && Object.keys(options.body.query).length === 0) delete options.body.query;
923928
queryParams = serialize(options.body);
924929
}
925930

0 commit comments

Comments
 (0)