mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 13:16:05 +00:00
Update http.js
This commit is contained in:
parent
799fa588d0
commit
ca5a256afb
38
lib/http.js
38
lib/http.js
|
@ -533,28 +533,34 @@ var HTTPObject = function(engine) {
|
||||||
var str = String(str);
|
var str = String(str);
|
||||||
var Lpos = str.indexOf('{');
|
var Lpos = str.indexOf('{');
|
||||||
var Rpos = str.indexOf('}', Lpos + 1);
|
var Rpos = str.indexOf('}', Lpos + 1);
|
||||||
var s1 = [], s2 = null, s3, s4;
|
var s0 = '', s1 = [], s2 = null, s3, s4;
|
||||||
|
var regex = /^[\w\-\s]+$/;
|
||||||
|
|
||||||
while (Lpos > -1 && Rpos > -1) {
|
while (Lpos > -1 && Rpos > -1) {
|
||||||
s1 = str.substring(Lpos + 1, Rpos).split(' ');
|
s0 = str.substring(Lpos + 1, Rpos);
|
||||||
|
|
||||||
while (s1.length > 0) {
|
if (!regex.test(s0)) {
|
||||||
s3 = s1.pop();
|
s2 = '{' + s0 + '}';
|
||||||
|
} else {
|
||||||
|
s1 = s0.split(' ');
|
||||||
|
while (s1.length > 0) {
|
||||||
|
s3 = s1.pop();
|
||||||
|
|
||||||
if (s3 in this.variables) {
|
if (s3 in this.variables) {
|
||||||
switch (typeof(this.variables[s3])) {
|
switch (typeof(this.variables[s3])) {
|
||||||
case "function":
|
case "function":
|
||||||
s2 = this.variables[s3](s2);
|
s2 = this.variables[s3](s2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
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];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user