Browse Source

Trim token

pull/1578/head
SubZero0 5 years ago
parent
commit
5e602c9365
1 changed files with 6 additions and 10 deletions
  1. +6
    -10
      src/Discord.Net.Rest/DiscordRestApiClient.cs

+ 6
- 10
src/Discord.Net.Rest/DiscordRestApiClient.cs View File

@@ -80,17 +80,13 @@ namespace Discord.API
/// <exception cref="ArgumentException">Unknown OAuth token type.</exception>
internal static string GetPrefixedToken(TokenType tokenType, string token)
{
switch (tokenType)
return tokenType switch
{
case default(TokenType):
return token;
case TokenType.Bot:
return $"Bot {token}";
case TokenType.Bearer:
return $"Bearer {token}";
default:
throw new ArgumentException(message: "Unknown OAuth token type.", paramName: nameof(tokenType));
}
default(TokenType) => token?.TrimEnd(),
TokenType.Bot => $"Bot {token?.TrimEnd()}",
TokenType.Bearer => $"Bearer {token?.TrimEnd()}",
_ => throw new ArgumentException(message: "Unknown OAuth token type.", paramName: nameof(tokenType)),
};
}
internal virtual void Dispose(bool disposing)
{


Loading…
Cancel
Save