mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
feat(Browser): remove browser � (#5113)
This commit is contained in:
@@ -4,7 +4,7 @@ const https = require('https');
|
||||
const FormData = require('@discordjs/form-data');
|
||||
const AbortController = require('abort-controller');
|
||||
const fetch = require('node-fetch');
|
||||
const { browser, UserAgent } = require('../util/Constants');
|
||||
const { UserAgent } = require('../util/Constants');
|
||||
|
||||
if (https.Agent) var agent = new https.Agent({ keepAlive: true });
|
||||
|
||||
@@ -37,7 +37,7 @@ class APIRequest {
|
||||
|
||||
if (this.options.auth !== false) headers.Authorization = this.rest.getAuth();
|
||||
if (this.options.reason) headers['X-Audit-Log-Reason'] = encodeURIComponent(this.options.reason);
|
||||
if (!browser) headers['User-Agent'] = UserAgent;
|
||||
headers['User-Agent'] = UserAgent;
|
||||
if (this.options.headers) headers = Object.assign(headers, this.options.headers);
|
||||
|
||||
let body;
|
||||
@@ -45,7 +45,7 @@ class APIRequest {
|
||||
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));
|
||||
if (!browser) headers = Object.assign(headers, body.getHeaders());
|
||||
headers = Object.assign(headers, body.getHeaders());
|
||||
// eslint-disable-next-line eqeqeq
|
||||
} else if (this.options.data != null) {
|
||||
body = JSON.stringify(this.options.data);
|
||||
|
||||
Reference in New Issue
Block a user