Created
January 12, 2019 06:38
-
-
Save alefcarlos/e3e6d0e1f4df0653489b95fd9a175b31 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
namespace ConsoleApp | |
{ | |
public class ApiService | |
{ | |
private readonly HttpClient _client; | |
public ApiService(HttpClient client) | |
{ | |
_client = client; | |
_client.DefaultRequestHeaders.Accept.Clear(); | |
_client.BaseAddress = new System.Uri("https://localhost:5000/api/"); | |
} | |
public async Task TimeoutAsync(int timeoutSeconds, int retrySuccess) | |
{ | |
var response = await _client.GetAsync($"example/timeout/{timeoutSeconds}/complete/{retrySuccess}"); | |
} | |
public async Task ErrorAsync(int errorCode, int retrySuccess) | |
{ | |
var response = await _client.GetAsync($"example/error/{errorCode}/complete/{retrySuccess}"); | |
} | |
public async Task SuccessAsync() | |
{ | |
var response = await _client.GetAsync("example/success/"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment