mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 23:16:28 +00:00
Implemented own client for async-requests (Should close #55)
This commit is contained in:
parent
323561909e
commit
f320dae4ce
@ -71,8 +71,14 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public async Task<byte[]> DownloadRawAsync(string url)
|
public async Task<byte[]> DownloadRawAsync(string url)
|
||||||
{
|
{
|
||||||
|
using (WebClient webClient = new WebClient())
|
||||||
|
{
|
||||||
|
webClient.Proxy = null;
|
||||||
|
webClient.Encoding = _encoding;
|
||||||
|
webClient.Headers = _webClient.Headers;
|
||||||
return await _webClient.DownloadDataTaskAsync(url);
|
return await _webClient.DownloadDataTaskAsync(url);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public T DownloadJson<T>(string url)
|
public T DownloadJson<T>(string url)
|
||||||
{
|
{
|
||||||
@ -129,8 +135,14 @@ 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)
|
||||||
{
|
{
|
||||||
|
using (WebClient webClient = new WebClient())
|
||||||
|
{
|
||||||
|
webClient.Proxy = null;
|
||||||
|
webClient.Encoding = _encoding;
|
||||||
|
webClient.Headers = _webClient.Headers;
|
||||||
return await _webClient.UploadDataTaskAsync(url, method, _encoding.GetBytes(body));
|
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