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