This package adds JsonMediaTypeFormatter
class for formatting HttpClient
requests and responses:
using (var client = new HttpClient())
{
var formatter = new JsonMediaTypeFormatter();
var request = new SearchProductRequest { Name = 'iphone', OrderBy = 'id' };
var content = new ObjectContent<SearchProductRequest>(request, formatter);
var response = await client.PostAsync("http://localhost/api/products:search", content);
var products = await response.Content.ReadAsAsync<Product[]>(new[] {formatter});
}
dotnet add package Byndyusoft.Net.Http.Json
To contribute, you will need to setup your local environment, see prerequisites. For the contribution and workflow guide, see package development lifecycle.
A detailed overview on how to contribute can be found in the contributing guide.
Make sure you have installed all of the following prerequisites on your development machine:
- Git - Download & Install Git. OSX and Linux machines typically have this already installed.
- .NET Core (version 3.1 or higher) - Download & Install .NET Core.
- source code
- unit-tests
- Implement package logic in
src
- Add or addapt unit-tests (prefer before and simultaneously with coding) in
tests
- Add or change the documentation as needed
- Open pull request in the correct branch. Target the project's
master
branch