Update http.js

This commit is contained in:
Namhyeon Go 2022-05-06 16:52:39 +09:00 committed by GitHub
parent f41bd517f4
commit 5d1817eef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,11 +33,13 @@ var HTTPObject = function(engine) {
"base64json": function(v) { "base64json": function(v) {
return BASE64.encode(JSON.stringify(v)); return BASE64.encode(JSON.stringify(v));
}, },
"unixnow": function() { "unixnow": function(diff) {
return Math.floor(new Date().getTime() / 1000); var t = parseInt(diff);
return Math.floor(new Date().getTime() / 1000) - t;
}, },
"unixnowms": function() { "unixnowms": function(diff) {
return new Date().getTime(); var t = parseInt(diff);
return new Date().getTime() - t;
} }
}; };
this.connectTimeout = 0; this.connectTimeout = 0;
@ -613,13 +615,17 @@ var HTTPObject = function(engine) {
case "object": case "object":
s4 = this.variables[s3]; s4 = this.variables[s3];
for (var k in s4) s4[k] = this.evaluate(s4[k]); for (var k in s4) {
s4[k] = this.evaluate(s4[k]);
}
s2 = s4; s2 = s4;
break; break;
default: default:
s2 = this.variables[s3]; s2 = this.variables[s3];
} }
} else {
s2 = s3;
} }
} }
str = str.substring(0, Lpos) + s2 + str.substring(Rpos + 1); str = str.substring(0, Lpos) + s2 + str.substring(Rpos + 1);