Skip to content

Commit d0baabc

Browse files
committed
【fix】修复filedvalus中有null时增删改要素请求报fieldname和fieldvalue长度不匹配的问题 review by luoxiao
1 parent e32b449 commit d0baabc

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/common/commontypes/Util.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -804,12 +804,15 @@ SuperMap.Util.toJSON = function (obj) {
804804
objInn = objInn.replace(/%/g, "%25");
805805
objInn = objInn.replace(/&/g, "%26");
806806
return objInn;
807-
case Array:
808-
var arr = [];
807+
case Array:
808+
var arr = '';
809809
for (var i = 0, len = objInn.length; i < len; i++) {
810-
arr.push(SuperMap.Util.toJSON(objInn[i]));
810+
arr += SuperMap.Util.toJSON(objInn[i]);
811+
if (i !== objInn.length - 1) {
812+
arr += ',';
813+
}
811814
}
812-
return "[" + arr.join(",") + "]";
815+
return "[" + arr + "]";
813816
case Number:
814817
return isFinite(objInn) ? String(objInn) : null;
815818
case Boolean:

test/common/commontypes/UtilSpec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ describe('Util', () => {
253253
var funResults = Util.toJSON(funObj);
254254
expect(funResults).toEqual("aaa");
255255
});
256+
it('toJSON_array_null', () => {
257+
var obj = {test:['a',null,'b']};
258+
var result = Util.toJSON(obj);
259+
expect(result).toContain(',null,')
260+
});
256261

257262
it('getResolutionFromScaleDpi', () => {
258263
var scale = 4.629244301712164E-9;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy