From cc0e10e451cf678c437e82ca8afea94bb1e46da1 Mon Sep 17 00:00:00 2001 From: SubZero0 Date: Sun, 21 Jun 2020 10:57:24 -0300 Subject: [PATCH] Trim when assigning to AuthToken --- src/Discord.Net.Rest/DiscordRestApiClient.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs index bc515d90d..c29f5e217 100644 --- a/src/Discord.Net.Rest/DiscordRestApiClient.cs +++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs @@ -82,9 +82,9 @@ namespace Discord.API { return tokenType switch { - default(TokenType) => token?.TrimEnd(), - TokenType.Bot => $"Bot {token?.TrimEnd()}", - TokenType.Bearer => $"Bearer {token?.TrimEnd()}", + default(TokenType) => token, + TokenType.Bot => $"Bot {token}", + TokenType.Bearer => $"Bearer {token}", _ => throw new ArgumentException(message: "Unknown OAuth token type.", paramName: nameof(tokenType)), }; } @@ -129,7 +129,7 @@ namespace Discord.API RestClient.SetCancelToken(_loginCancelToken.Token); AuthTokenType = tokenType; - AuthToken = token; + AuthToken = token?.TrimEnd(); if (tokenType != TokenType.Webhook) RestClient.SetHeader("authorization", GetPrefixedToken(AuthTokenType, AuthToken));