DotNetHelper-HttpClient
DotNetHelper-HttpClient is a simple lightweight library for execute restful requests. Easy Integration with polly. Support both asynchronous and synchronous operation
|| View on Github ||
Features
- All apis are available in both asynchronous and synchronous operation
Get string from rest api
var client = new RestClient();
var json = client.GetString($"https://jsonplaceholder.typicode.com/todos/1", Method.Get);
Get Stream from rest api
var client = new RestClient();
var stream = client.GetStream($"https://jsonplaceholder.typicode.com/todos/1", Method.Get);
Get bytes[] from rest api
var client = new RestClient();
var bytes = client.GetBytes($"https://jsonplaceholder.typicode.com/todos/1", Method.Get);
Get HttpResponseMessage from rest api
var client = new RestClient();
var httpResponse = client.GetHttpResponse($"https://jsonplaceholder.typicode.com/todos/1", Method.Get);
Get Generic Type from rest api
var client = new RestClient();
// The first parameter takes a Func<string, T> this allows you to implement your own deserializer
// In doing this allows this library to not depend on third party libraries which locks
// developer to using certain version
var employee = client.Get(JsonConvert.DeserializeObject<Employee>,$"https://jsonplaceholder.typicode.com/todos/1", Method.Get);