Skip to content

Commit

Permalink
Fix toQueryString function for null values
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismayer committed Nov 13, 2023
1 parent 1aa34bf commit 884ab9b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/util/Url.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ const UrlUtil = {
toQueryString (obj) {
return Object.keys(obj)
.reduce((a, k) => {
a.push(
typeof obj[k] === 'object'
? this.toQueryString(obj[k])
: `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`
);
if (obj[k]) {
a.push(
(typeof obj[k] === 'object')
? this.toQueryString(obj[k])
: `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`
);
}
return a;
}, [])
.join('&');
Expand Down

0 comments on commit 884ab9b

Please sign in to comment.