Implemented own client for async-requests (Should close #55)

This commit is contained in:
Johnny @PC 2015-11-15 20:54:30 +01:00
parent 323561909e
commit f320dae4ce

View File

@ -71,7 +71,13 @@ namespace SpotifyAPI.Web
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)
@ -129,7 +135,13 @@ namespace SpotifyAPI.Web
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)