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