Skip to content

Commit

Permalink
Only add query parameters if they are necessary (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Modder Me committed May 16, 2022
1 parent 7395789 commit 2f43152
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ exports = function(options) {

if (type === 'GET') {
data = query.stringify(data);
url += url.indexOf('?') > -1 ? '&' + data : '?' + data;
if (data) url += url.indexOf('?') > -1 ? '&' + data : '?' + data;
} else if (options.contentType === 'application/x-www-form-urlencoded') {
if (isObj(data)) data = query.stringify(data);
} else if (options.contentType === 'application/json') {
Expand Down

0 comments on commit 2f43152

Please sign in to comment.