mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update http.js
This commit is contained in:
parent
e73358de36
commit
a371550f9e
17
lib/http.js
17
lib/http.js
|
@ -32,6 +32,12 @@ var HTTPObject = function(engine) {
|
|||
"uuidv4": RAND.uuidv4,
|
||||
"base64json": function(v) {
|
||||
return BASE64.encode(JSON.stringify(v));
|
||||
},
|
||||
"unixnow": function() {
|
||||
return Math.floor(new Date().getTime() / 1000);
|
||||
},
|
||||
"unixnowms": function() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
};
|
||||
this.connectTimeout = 0;
|
||||
|
@ -308,11 +314,12 @@ var HTTPObject = function(engine) {
|
|||
var url = this.serializeParameters(url);
|
||||
|
||||
this.setMethod(method.toUpperCase()); // set method
|
||||
this.setHeader("User-Agent", (this.userAgent != null ? this.userAgent : '')); // set user agent
|
||||
this.pushState(null, null, url); // push state
|
||||
this.setHeader("User-Agent", (this.userAgent != null ? this.userAgent : '')); // user agent
|
||||
|
||||
try {
|
||||
if (this.engine == "MSXML") {
|
||||
// Open
|
||||
switch (this.method) {
|
||||
case "POST":
|
||||
this.interface.open(method, url, this.isAsync);
|
||||
|
@ -400,7 +407,7 @@ var HTTPObject = function(engine) {
|
|||
cmd.push(this.connectTimeout);
|
||||
}
|
||||
|
||||
// Add the credential parameters
|
||||
// Add the credential parameters
|
||||
switch (this.credential.method.toUpperCase()) {
|
||||
case "BASIC":
|
||||
cmd.push("-u");
|
||||
|
@ -447,7 +454,11 @@ var HTTPObject = function(engine) {
|
|||
}
|
||||
}
|
||||
|
||||
console.log("Received", responseText.length, "bytes");
|
||||
if (typeof responseText === "string") {
|
||||
console.log("Received", responseText.length, "bytes");
|
||||
} else {
|
||||
console.log("No received anything");
|
||||
}
|
||||
|
||||
if (this.isJSONResponse()) {
|
||||
if (typeof(WScript) !== "undefined") {
|
||||
|
|
Loading…
Reference in New Issue
Block a user