using System;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Common.Net
{
///
/// Default http client.
///
public class DefaultHttpClient
{
private readonly HttpClient _httpClient;
///
/// Initializes a new instance of the class.
///
/// Instance of httpclient.
public DefaultHttpClient(HttpClient httpClient)
{
_httpClient = httpClient;
}
///
/// Make GET request.
///
/// Url to request.
/// A containing the .
public Task GetAsync(string url)
{
return _httpClient.GetAsync(url);
}
///
/// Make GET request.
///
/// Url to request.
/// A containing the .
public Task GetAsync(Uri url)
{
return _httpClient.GetAsync(url);
}
///
/// Make GET request.
///
/// Url to request.
/// The cancellation token.
/// A containing the .
public Task GetAsync(string url, CancellationToken cancellationToken)
{
return _httpClient.GetAsync(url, cancellationToken);
}
///
/// Make GET request.
///
/// Url to request.
/// The cancellation token.
/// A containing the .
public Task GetAsync(Uri url, CancellationToken cancellationToken)
{
return _httpClient.GetAsync(url, cancellationToken);
}
///
/// Get stream.
///
/// Url to get stream from.
/// A containing the .
public Task GetStreamAsync(string url)
{
return _httpClient.GetStreamAsync(url);
}
///
/// Get stream.
///
/// Url to get stream from.
/// A containing the .
public Task GetStreamAsync(Uri url)
{
return _httpClient.GetStreamAsync(url);
}
///
/// Send request.
///
/// The .
/// A containing the .
public Task SendAsync(HttpRequestMessage requestMessage)
{
return _httpClient.SendAsync(requestMessage);
}
///
/// Send request.
///
/// The .
/// The cancellation token.
/// A containing the .
public Task SendAsync(HttpRequestMessage requestMessage, CancellationToken cancellationToken)
{
return _httpClient.SendAsync(requestMessage, cancellationToken);
}
}
}