fix: filtering of string forms of null and undefined (#5075)

Removed null and undefined being filtered out in string forms which caused issues in `<client>.api`, issue: https://github.com/discordjs/discord.js/issues/5072
This commit is contained in:
VoltrexMaster
2020-12-13 05:43:52 +03:30
committed by GitHub
parent 12c909eecc
commit 9042d19c4e

View File

@@ -20,7 +20,7 @@ class APIRequest {
let queryString = '';
if (options.query) {
const query = Object.entries(options.query)
.filter(([, value]) => ![null, 'null', 'undefined'].includes(value) && typeof value !== 'undefined')
.filter(([, value]) => value !== null && typeof value !== 'undefined')
.flatMap(([key, value]) => (Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]));
queryString = new URLSearchParams(query).toString();
}