mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-13 05:01:03 +00:00
Update http.js
This commit is contained in:
parent
c5e7842c43
commit
1ae2c7a814
24
lib/http.js
24
lib/http.js
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user