replace %username at the request level

pull/89/head
Bernat Romagosa 2019-04-17 20:34:38 +02:00
rodzic d3beb9e38c
commit ad8b78fb72
1 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -164,12 +164,16 @@ Cloud.prototype.request = function (
body) {
var request = new XMLHttpRequest(),
myself = this;
myself = this,
fullPath = this.url +
(path.indexOf('%username') > -1 ?
path.replace('%username', encodeURIComponent(this.username)) :
path);
try {
request.open(
method,
this.url + path,
fullPath,
true
);
request.setRequestHeader(
@ -232,7 +236,7 @@ Cloud.prototype.withCredentialsRequest = function (
myself.request(
method,
// %username is replaced by the actual username
path.replace('%username', encodeURIComponent(username)),
path,
onSuccess,
onError,
errorMsg,