mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 14:02:02 +00:00
fix(APIRequest): only use form data when actually sending files (#3917)
This commit is contained in:
parent
79a28b55a8
commit
a4f7e07b3b
1 changed files with 1 additions and 1 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in a new issue