Skip to content

Commit

Permalink
removing unnecessary if statement, qs.stringify does a truthiness che…
Browse files Browse the repository at this point in the history
…ck by default
  • Loading branch information
joseplatas committed Sep 4, 2019
1 parent 4b6e7c1 commit 4dadf9f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,10 @@ module.exports = function (xhr) {
if (options.data && type === 'GET') {
// make sure we've got a '?'
options.url += includes(options.url, '?') ? '&' : '?';
// set stringify encoding options and create a different URI output if needed
// set stringify encoding options and create a different URI output if qsOption is defined
// ex) qsOptions = { indices: false }
// https://www.npmjs.com/package/qs/v/4.0.0#stringifying
if(options.qsOptions){
options.url += qs.stringify(options.data, options.qsOptions);
}else{
options.url += qs.stringify(options.data);
}
options.url += qs.stringify(options.data, options.qsOptions);

//delete `data` so `xhr` doesn't use it as a body
delete options.data;
Expand Down

0 comments on commit 4dadf9f

Please sign in to comment.