You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Utils: escapeSpecialChars now handles escape sequences that may break JSON.parse()
Data posted by the client may contain stacktraces and other strings that contain escape sequences such as \n.
escapeSpecialChars now handles a wider set of whitespace escape sequences that would otherwise break JSON.parse.
May require support for more escape chars, but this might suffice for most cases.
Fixes#99
it('should return number of keys for this object',function(){
36
36
assert.equal(0,utils.objectSize({}));
37
37
assert.equal(1,utils.objectSize({a: 2}));
38
38
});
39
+
40
+
it('should escape special characters incompatible with JSON.parse',function(){
41
+
vartestString='{"tracebacks":[{"actual":null,"message":"Died on test #1 at http://localhost:8888/test/main/globals.js:43:7\n at http://localhost:8888/test/main/globals.js:67:2: Error","testName":"globals: Exported assertions"}]}';
42
+
varexpectString='{"tracebacks":[{"actual":null,"message":"Died on test #1 at http://localhost:8888/test/main/globals.js:43:7\\n at http://localhost:8888/test/main/globals.js:67:2: Error","testName":"globals: Exported assertions"}]}';
0 commit comments