Updated
This commit is contained in:
@@ -8,7 +8,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EonaCat.HttpClient" Version="1.1.2" />
|
||||
<Reference Include="EonaCat.Helpers">
|
||||
<HintPath>..\..\EonaCatHelpers\EonaCat.Helpers\bin\Release\net5.0\EonaCat.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EonaCat.HttpClient">
|
||||
<HintPath>..\..\EonaCatHttpClient\bin\Debug\EonaCat.HttpClient.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
38
HttpClient/Large_Json.cs
Normal file
38
HttpClient/Large_Json.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
namespace EonaCat.Testers.HttpClient
|
||||
{
|
||||
public class Actor
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string login { get; set; }
|
||||
public string gravatar_id { get; set; }
|
||||
public string url { get; set; }
|
||||
public string avatar_url { get; set; }
|
||||
}
|
||||
|
||||
public class Repo
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string url { get; set; }
|
||||
}
|
||||
|
||||
public class Payload
|
||||
{
|
||||
public string @ref { get; set; }
|
||||
public string ref_type { get; set; }
|
||||
public string master_branch { get; set; }
|
||||
public string description { get; set; }
|
||||
public string pusher_type { get; set; }
|
||||
}
|
||||
|
||||
public class Large_Json
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string type { get; set; }
|
||||
public Actor actor { get; set; }
|
||||
public Repo repo { get; set; }
|
||||
public Payload payload { get; set; }
|
||||
public bool @public { get; set; }
|
||||
public DateTime created_at { get; set; }
|
||||
}
|
||||
}
|
@@ -1,13 +1,26 @@
|
||||
|
||||
using EonaCat.HttpClient;
|
||||
|
||||
namespace EonaCat.Testers.HttpClient
|
||||
{
|
||||
public static class HttpClientTest
|
||||
{
|
||||
public static void Main()
|
||||
private const string Large_Json_file = "https://raw.githubusercontent.com/json-iterator/test-data/master/large-file.json";
|
||||
|
||||
public static async Task Main()
|
||||
{
|
||||
Console.WriteLine("Test");
|
||||
var httpClient = new EonaCat.HttpClient.HttpClient("test");
|
||||
httpClient.
|
||||
var httpClient = new EonaCat.HttpClient.HttpClient(Large_Json_file);
|
||||
var getRequest = httpClient.GetRequest();
|
||||
var response = await getRequest.ExecuteAsync<List<Large_Json>>().ConfigureAwait(false);
|
||||
Console.WriteLine($"We got {(response.HasResult ? response.Result.Count : 0)} results - elapsed: {response.Elapsed.Value}");
|
||||
|
||||
Console.WriteLine("Test2");
|
||||
var httpClient2 = new EonaCat.HttpClient.HttpClient("https://google.com");
|
||||
var getRequest2 = httpClient2.GetRequest();
|
||||
var response2 = await getRequest2.ExecuteAsHttpResponseMessageAsync().ConfigureAwait(false);
|
||||
Console.WriteLine($"We got {(response2.HasResult ? await response2.Result.Content.ReadAsStringAsync() : 0)} - elapsed: {response2.Elapsed.Value}");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user