mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
chore: consistency/prettier (#3852)
* chore: consistency/prettier * chore: rebase * chore: rebase * chore: include typings * fix: include typings file in prettier lint-staged
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const FormData = require('form-data');
|
||||
const https = require('https');
|
||||
const { browser, UserAgent } = require('../util/Constants');
|
||||
const fetch = require('node-fetch');
|
||||
const AbortController = require('abort-controller');
|
||||
const FormData = require('form-data');
|
||||
const fetch = require('node-fetch');
|
||||
const { browser, UserAgent } = require('../util/Constants');
|
||||
|
||||
if (https.Agent) var agent = new https.Agent({ keepAlive: true });
|
||||
|
||||
@@ -26,8 +26,10 @@ class APIRequest {
|
||||
}
|
||||
|
||||
make() {
|
||||
const API = this.options.versioned === false ? this.client.options.http.api :
|
||||
`${this.client.options.http.api}/v${this.client.options.http.version}`;
|
||||
const API =
|
||||
this.options.versioned === false
|
||||
? this.client.options.http.api
|
||||
: `${this.client.options.http.api}/v${this.client.options.http.version}`;
|
||||
const url = API + this.path;
|
||||
let headers = {};
|
||||
|
||||
@@ -42,7 +44,8 @@ class APIRequest {
|
||||
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));
|
||||
if (!browser) headers = Object.assign(headers, body.getHeaders());
|
||||
} else if (this.options.data != null) { // eslint-disable-line eqeqeq
|
||||
// eslint-disable-next-line eqeqeq
|
||||
} else if (this.options.data != null) {
|
||||
body = JSON.stringify(this.options.data);
|
||||
headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user