/aspnetcore-httpclientextensions

Json verb extensions for ASP.NET core HttpClient

Primary LanguageC#MIT LicenseMIT

aspnetcore-httpclientextensions

CircleCI

About ASP.NET Core HttpClient Extensions

Adds extension methods that allow you pass strongly typed objects as parameters to the HttpClient instance.

Usage

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);

Other methods

the library also provides two other extension methods; PutAsJsonAsync and ReadAsJsonAsync.