Update http.js

This commit is contained in:
Namhyeon Go 2022-01-17 18:44:31 +09:00 committed by GitHub
parent c5e7842c43
commit 1ae2c7a814
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -234,14 +234,14 @@ var HTTPObject = function(engine) {
} }
}; };
this.serializeURL = function(parametersObject) { this.serializeURL = function(parameters) {
var str = []; var s = [];
for (var k in parametersObject) { for (var k in parameters) {
if (parametersObject.hasOwnProperty(k)) { if (parameters.hasOwnProperty(k)) {
str.push(encodeURIComponent(k) + "=" + encodeURIComponent(parametersObject[k])); s.push(encodeURIComponent(k) + "=" + encodeURIComponent(parameters[k]));
} }
} }
return str.join("&"); return s.join("&");
}; };
// Type 1: http://domain?a=1&b=2&c=3 // Type 1: http://domain?a=1&b=2&c=3
@ -279,11 +279,9 @@ var HTTPObject = function(engine) {
}; };
this.open = function(method, url) { this.open = function(method, url) {
var url = this.serializeParameters(url);
this.setMethod(method.toUpperCase()); // set method this.setMethod(method.toUpperCase()); // set method
this.pushState(null, null, url); // push stat
this.setHeader("User-Agent", (this.userAgent != null ? this.userAgent : '')); // set user agent this.setHeader("User-Agent", (this.userAgent != null ? this.userAgent : '')); // set user agent
this.pushState(null, null, this.serializeParameters(url)); // push state
try { try {
if (this.engine == "MSXML") { if (this.engine == "MSXML") {
@ -361,13 +359,11 @@ var HTTPObject = function(engine) {
cmd.push("-A"); cmd.push("-A");
cmd.push((this.userAgent != null ? this.userAgent : '')); cmd.push((this.userAgent != null ? this.userAgent : ''));
/* // Add the request body if this is not GET method
var pos = url.indexOf('?'); if (this.method !== "GET") {
if (pos > -1) {
cmd.push("-d"); cmd.push("-d");
cmd.push(state.url.substring(pos + 1)); cmd.push(this.requestBody);
} }
*/
cmd.push(state.url); cmd.push(state.url);