mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user