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) {
var str = [];
for (var k in parametersObject) {
if (parametersObject.hasOwnProperty(k)) {
str.push(encodeURIComponent(k) + "=" + encodeURIComponent(parametersObject[k]));
this.serializeURL = function(parameters) {
var s = [];
for (var k in parameters) {
if (parameters.hasOwnProperty(k)) {
s.push(encodeURIComponent(k) + "=" + encodeURIComponent(parameters[k]));
}
}
return str.join("&");
return s.join("&");
};
// Type 1: http://domain?a=1&b=2&c=3
@ -279,11 +279,9 @@ var HTTPObject = function(engine) {
};
this.open = function(method, url) {
var url = this.serializeParameters(url);
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.pushState(null, null, this.serializeParameters(url)); // push state
try {
if (this.engine == "MSXML") {
@ -361,14 +359,12 @@ var HTTPObject = function(engine) {
cmd.push("-A");
cmd.push((this.userAgent != null ? this.userAgent : ''));
/*
var pos = url.indexOf('?');
if (pos > -1) {
// Add the request body if this is not GET method
if (this.method !== "GET") {
cmd.push("-d");
cmd.push(state.url.substring(pos + 1));
cmd.push(this.requestBody);
}
*/
cmd.push(state.url);
// Get response text