mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 06:36:26 +00:00
use recommendations for latest .NET versions
This commit is contained in:
parent
16d898b344
commit
4aea443038
@ -21,9 +21,9 @@ namespace SpotifyAPI.Web
|
||||
var body = new JObject();
|
||||
var type = GetType();
|
||||
|
||||
if (!_bodyParamsCache.IsEmpty && _bodyParamsCache.ContainsKey(type))
|
||||
if (!_bodyParamsCache.IsEmpty && _bodyParamsCache.TryGetValue(type, out var bodyParamsCached))
|
||||
{
|
||||
foreach (var (info, attribute) in _bodyParamsCache[type])
|
||||
foreach (var (info, attribute) in bodyParamsCached)
|
||||
{
|
||||
AddBodyParam(body, info, attribute);
|
||||
}
|
||||
@ -70,9 +70,9 @@ namespace SpotifyAPI.Web
|
||||
var queryParams = new Dictionary<string, string>();
|
||||
var type = GetType();
|
||||
|
||||
if (!_queryParamsCache.IsEmpty && _queryParamsCache.ContainsKey(type))
|
||||
if (!_queryParamsCache.IsEmpty && _queryParamsCache.TryGetValue(type, out var queryParamsCached))
|
||||
{
|
||||
foreach (var (info, attribute) in _queryParamsCache[type])
|
||||
foreach (var (info, attribute) in queryParamsCached)
|
||||
{
|
||||
AddQueryParam(queryParams, info, attribute);
|
||||
}
|
||||
|
@ -63,8 +63,12 @@ namespace SpotifyAPI.Web
|
||||
|
||||
private static byte[] ComputeSHA256(string value)
|
||||
{
|
||||
#if NETSTANDARD2_1_OR_GREATER
|
||||
using var hash = SHA256.Create();
|
||||
return hash.ComputeHash(Encoding.UTF8.GetBytes(value));
|
||||
#else
|
||||
return SHA256.HashData(Encoding.UTF8.GetBytes(value));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user