Skip to content

Instantly share code, notes, and snippets.

@Mirch
Last active October 13, 2018 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mirch/1126bcdd5c4dd028985f9ecf702f626e to your computer and use it in GitHub Desktop.
Save Mirch/1126bcdd5c4dd028985f9ecf702f626e to your computer and use it in GitHub Desktop.
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