Adds extension methods that allow you pass strongly typed objects as parameters to the HttpClient
instance.
To make use of this library, add it to your project from Nuget using any of the following methods.
PM> Install-Package AspNet.Http.Extensions
or
dotnet add package AspNet.Http.Extensions
or
paket add AspNet.Http.Extensions
Add the appropriate namespace to your class
using AspNet.Http.Extensions;
Create an instance of HttpClient
var client = new HttpClient();
Create an instance of your payload class
var payload = new Foo { Name = "Bar" };
Make your HTTP request
var response = client.PostAsJsonAsync('url', payload);
the library also provides two other extension methods; PutAsJsonAsync
and ReadAsJsonAsync
.