Update URL expression (e.g. http://domain/:a/:b)

This commit is contained in:
Namhyeon Go 2022-01-05 11:49:46 +09:00 committed by GitHub
parent 966f554d0f
commit 3997be2baf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,6 +216,8 @@ var HTTPObject = function() {
// Type 1: http://domain?a=1&b=2&c=3 // Type 1: http://domain?a=1&b=2&c=3
// Type 2: http://domain/:a/:b/:c // Type 2: http://domain/:a/:b/:c
this.serializeParameters = function(url) { this.serializeParameters = function(url) {
console.log(Object.keys(this.parameters).join(","));
if (Object.keys(this.parameters).length > 0) { if (Object.keys(this.parameters).length > 0) {
// Type 2 // Type 2
var parameters = {}; var parameters = {};
@ -228,14 +230,18 @@ var HTTPObject = function() {
} }
// Type 1 // Type 1
if (Object.keys(parameters).length > 0) {
if (url.indexOf('?') > -1) { if (url.indexOf('?') > -1) {
return url + '&' + this.serializeURL(parameters); url += '&' + this.serializeURL(parameters);
} else { } else {
return url + '?' + this.serializeURL(parameters); url += '?' + this.serializeURL(parameters);
} }
} else { }
}
console.log("Requested URL: " + url);
return url; return url;
}
}; };
this.open = function(method, url) { this.open = function(method, url) {
@ -286,6 +292,8 @@ var HTTPObject = function() {
sleep(100); sleep(100);
} }
console.log("ResponseText: " + this.interface.responseText);
if (this.isJSONResponse()) { if (this.isJSONResponse()) {
if (typeof(WScript) !== "undefined") { if (typeof(WScript) !== "undefined") {
JSON = {}; JSON = {};