Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/spotify-web-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ var SpotifyWebApi = (function () {
return target;
};

var _buildUrl = function (url, parameters) {
var _buildUrl = function (url, parameters, dontEncodePlus) {
var qs = '';
for (var key in parameters) {
if (parameters.hasOwnProperty(key)) {
var value = parameters[key];
qs += encodeURIComponent(key) + '=' + encodeURIComponent(value) + '&';
if (dontEncodePlus) {
qs += encodeURIComponent(key) + '=' + value.split('+').map(x => encodeURIComponent(x)).join('+') + '&';
} else {
qs += encodeURIComponent(key) + '=' + encodeURIComponent(value) + '&';
}
}
}
if (qs.length > 0) {
Expand Down Expand Up @@ -94,7 +98,7 @@ var SpotifyWebApi = (function () {
}

var type = requestData.type || 'GET';
req.open(type, _buildUrl(requestData.url, requestData.params));
req.open(type, _buildUrl(requestData.url, requestData.params, requestData.dontEncodePlus));
if (_accessToken) {
req.setRequestHeader('Authorization', 'Bearer ' + _accessToken);
}
Expand Down Expand Up @@ -1360,7 +1364,8 @@ var SpotifyWebApi = (function () {
params: {
q: query,
type: types.join(',')
}
},
dontEncodePlus: true
};
return _checkParamsAndPerformRequest(requestData, options, callback);
};
Expand Down