mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-11 17:34:58 +00:00
Update URL expression (e.g. http://domain/:a/:b)
This commit is contained in:
parent
966f554d0f
commit
3997be2baf
20
lib/http.js
20
lib/http.js
|
@ -216,6 +216,8 @@ var HTTPObject = function() {
|
|||
// Type 1: http://domain?a=1&b=2&c=3
|
||||
// Type 2: http://domain/:a/:b/:c
|
||||
this.serializeParameters = function(url) {
|
||||
console.log(Object.keys(this.parameters).join(","));
|
||||
|
||||
if (Object.keys(this.parameters).length > 0) {
|
||||
// Type 2
|
||||
var parameters = {};
|
||||
|
@ -228,14 +230,18 @@ var HTTPObject = function() {
|
|||
}
|
||||
|
||||
// Type 1
|
||||
if (url.indexOf('?') > -1) {
|
||||
return url + '&' + this.serializeURL(parameters);
|
||||
} else {
|
||||
return url + '?' + this.serializeURL(parameters);
|
||||
if (Object.keys(parameters).length > 0) {
|
||||
if (url.indexOf('?') > -1) {
|
||||
url += '&' + this.serializeURL(parameters);
|
||||
} else {
|
||||
url += '?' + this.serializeURL(parameters);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return url;
|
||||
}
|
||||
|
||||
console.log("Requested URL: " + url);
|
||||
|
||||
return url;
|
||||
};
|
||||
|
||||
this.open = function(method, url) {
|
||||
|
@ -286,6 +292,8 @@ var HTTPObject = function() {
|
|||
sleep(100);
|
||||
}
|
||||
|
||||
console.log("ResponseText: " + this.interface.responseText);
|
||||
|
||||
if (this.isJSONResponse()) {
|
||||
if (typeof(WScript) !== "undefined") {
|
||||
JSON = {};
|
||||
|
|
Loading…
Reference in New Issue
Block a user