From 7c51f731cb3dca369877454aafed60b851db0aef Mon Sep 17 00:00:00 2001 From: ITOH Date: Sun, 2 Apr 2023 18:54:36 +0200 Subject: [PATCH] refactor(rest): improve `unauthorized` readability (#2946) Currently we use a double negation in the code which makes it harder to understand what it actually does. Therefore the check has been changed to be understood easier. --- packages/rest/src/manager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rest/src/manager.ts b/packages/rest/src/manager.ts index 338403701..26ccbfd5b 100644 --- a/packages/rest/src/manager.ts +++ b/packages/rest/src/manager.ts @@ -694,7 +694,7 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage 'user-agent': `DiscordBot (https://github.com/discordeno/discordeno, v${version})`, } - if (!options?.unauthorized) headers.authorization = `Bot ${rest.token}` + if (options?.unauthorized !== false) headers.authorization = `Bot ${rest.token}` // IF A REASON IS PROVIDED ENCODE IT IN HEADERS if (options?.reason !== undefined) {