-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Please describe the problem you are having in as much detail as possible:
So i've been trying to play around with <client>.api and noticed the weird behavior of the query value changing in an unexpected way if given "null" and "undefined" as their value, as you see on the screenehot:

first i tried null as a string and it causes a DiscordAPIError instead of returning the expected array of members, also tried with multiple other values as you see on the screenshot:

as "null", "undefined" and "voltrex" and as you see, both of the "null" and "undefined" were casted to their original value and not considered a string while "voltrex" did work, however, doing a raw api request using node-fetch as you see on the screenshot:

with the same values, all are successful without returning an error
Include a reproducible code sample here, if possible:
// Using <client>.api
<client>.api.guilds(<ID>).members.search.get({
query: {
query: "null",
limit: 1
}
}); // DiscordAPIError: Invalid Form Body query: This field is required
// Using node-fetch
<node-fetch>("https://discord.com/api/guilds/<ID>/members/search?query=null&limit=1", {
headers: {
Authorization: "Bot <Your bot token here>"
}
}).then(res => res.json()); // Returns an array of members as expectedFurther details:
- discord.js version: 12.5.1
- Node.js version: v14.9.0
- Operating system: Ubuntu
- Priority this issue should have – please be realistic and elaborate if possible: low
Relevant client options:
-
partials: none
-
gateway intents: 1935
-
other: none
-
I have also tested the issue on latest master, commit hash: