simple.http's People
simple.http's Issues
README Update
SimpleHttpService
Installation
You can install the latest version of the package with the command dotnet add package Simple.Http
.
You can also install it manualy in your IDE with the nuget package manager by searching Simple.Http.
Getting started
If you're using dependency injection you can register the service thanks to the IHttpService interface. Or, you can use the service manualy by creating a new instance of HttpService.
After this you can use the library.
var simpleHttpResult = await simpleHttpService.SendHttpRequest(url, HttpMethod.Post, body);
Here we sent an HttpRequest on the route : url with a Post method and a body. In simpleHttpResult we obtain a formatted result :
public class SimpleHttpResult
{
public Exception Exception { get; set; }
public HttpStatusCode HttpStatusCode { get; set; }
public HttpRequestMessage RequestMessage { get; set; }
}
If an Exception is thrown we can get it into Exception. HttpStatusCode refer to the HttpStatusCode's request. The request message is the message sent to our url.
// Send a get method and get the request's content
var simpleHttpResult = await simpleHttpService.SendHttpRequest<MyDTO>(url, HttpMethod.Get);
MyDTO class can be like this :
public class MyDTO
{
[JsonProperty("name")]
public string Name { get; set; }
}
If we want to get returned our request's content we must use the method SendHttpRequest. We can get the returned value in the Result property.
public class SimpleHttpResult
{
public Exception Exception { get; set; }
public HttpStatusCode HttpStatusCode { get; set; }
public HttpRequestMessage RequestMessage { get; set; }
public TResult Result { get; set; }
}
That's all !
If you want to help the project, you can put a star on Github. If you have any problems, please let me know by creating an issue on Github or by asking for a pull request.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.