Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class RequestSender
{
private static HttpClient _CLIENT;
public RequestSender()
{
if (_CLIENT == null)
{
_CLIENT = new HttpClient();
_CLIENT.BaseAddress = new Uri("http://example.com/api/");
}
}
public async Task<string> Get(string path)
{
var response = await _client.GetStringAsync(path);
return response;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment