mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 06:56:27 +00:00
Implemented own client for async-requests (Should close #55)
This commit is contained in:
parent
323561909e
commit
f320dae4ce
@ -71,7 +71,13 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public async Task<byte[]> DownloadRawAsync(string url)
|
public async Task<byte[]> DownloadRawAsync(string url)
|
||||||
{
|
{
|
||||||
return await _webClient.DownloadDataTaskAsync(url);
|
using (WebClient webClient = new WebClient())
|
||||||
|
{
|
||||||
|
webClient.Proxy = null;
|
||||||
|
webClient.Encoding = _encoding;
|
||||||
|
webClient.Headers = _webClient.Headers;
|
||||||
|
return await _webClient.DownloadDataTaskAsync(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public T DownloadJson<T>(string url)
|
public T DownloadJson<T>(string url)
|
||||||
@ -129,7 +135,13 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public async Task<byte[]> UploadRawAsync(string url, string body, string method)
|
public async Task<byte[]> UploadRawAsync(string url, string body, string method)
|
||||||
{
|
{
|
||||||
return await _webClient.UploadDataTaskAsync(url, method, _encoding.GetBytes(body));
|
using (WebClient webClient = new WebClient())
|
||||||
|
{
|
||||||
|
webClient.Proxy = null;
|
||||||
|
webClient.Encoding = _encoding;
|
||||||
|
webClient.Headers = _webClient.Headers;
|
||||||
|
return await _webClient.UploadDataTaskAsync(url, method, _encoding.GetBytes(body));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public T UploadJson<T>(string url, string body, string method)
|
public T UploadJson<T>(string url, string body, string method)
|
||||||
|
Loading…
Reference in New Issue
Block a user