Commit 9dde1b53 authored by Thomas Lechauve's avatar Thomas Lechauve

Parse correctly the method url given by the server

parent 1bca49d8
...@@ -100,7 +100,9 @@ ...@@ -100,7 +100,9 @@
return this.each(function () { return this.each(function () {
$(this).slapos('discovery', function (access) { $(this).slapos('discovery', function (access) {
if (access.hasOwnProperty(methodName)) { if (access.hasOwnProperty(methodName)) {
var url = args.url || access[methodName].url; var url = access[methodName].url.replace(/{(\w+)}/, function (matchedText, $1) {
return "" + args[$1]
});
$.extend(args, {'url': url}); $.extend(args, {'url': url});
$this.slapos('request', $this.slapos('request',
access[methodName].method, access[methodName].method,
...@@ -129,13 +131,17 @@ ...@@ -129,13 +131,17 @@
}, },
instanceInfo: function (url, args) { instanceInfo: function (url, args) {
url = decodeURIComponent(url); $.extend(args, {'instance_url': decodeURIComponent(url)});
$.extend(args, {'url': url});
return $(this).slapos('prepareRequest', 'instance_info', args); return $(this).slapos('prepareRequest', 'instance_info', args);
}, },
instanceRequest: function (args) { instanceRequest: function (args) {
return $(this).slapos('prepareRequest', 'request_instance', args); return $(this).slapos('prepareRequest', 'request_instance', args);
},
instanceCertificate: function (url, args) {
$.extend(args, {'instance_url': decodeURIComponent(url)});
return $(this).slapos('prepareRequest', 'instance_certificate', args);
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment