kopia lustrzana https://github.com/backface/turtlestitch
replace %username at the request level
rodzic
d3beb9e38c
commit
ad8b78fb72
10
src/cloud.js
10
src/cloud.js
|
@ -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,
|
||||||
|
|
Ładowanie…
Reference in New Issue