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 600231e commit aeb81ee
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] !== null) {
a.push(
(typeof obj[k] === 'object')
? this.toQueryString(obj[k])
: `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`
);
}
return a;
}, [])
.join('&');
Expand Down

0 comments on commit aeb81ee

Please sign in to comment.