mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
fix(APIRequest): only use form data when actually sending files (#3917)
This commit is contained in:
@@ -39,7 +39,7 @@ class APIRequest {
|
||||
if (this.options.headers) headers = Object.assign(headers, this.options.headers);
|
||||
|
||||
let body;
|
||||
if (this.options.files) {
|
||||
if (this.options.files && this.options.files.length) {
|
||||
body = new FormData();
|
||||
for (const file of this.options.files) if (file && file.file) body.append(file.name, file.file, file.name);
|
||||
if (typeof this.options.data !== 'undefined') body.append('payload_json', JSON.stringify(this.options.data));
|
||||
|
||||
Reference in New Issue
Block a user