Update http.js

This commit is contained in:
Namhyeon Go 2022-04-04 15:11:07 +09:00 committed by GitHub
parent e73358de36
commit a371550f9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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") {