Skip to content

Provides extension methods for System.Net.Http.HttpClient and System.Net.Http.HttpContent that perform automatic serialization and deserialization using System.Text.Json.

License

Notifications You must be signed in to change notification settings

Byndyusoft/Byndyusoft.Net.Http.Json

Repository files navigation

Byndyusoft.Net.Http.Json

(License) Nuget NuGet downloads

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

Installing

dotnet add package Byndyusoft.Net.Http.Json

Contributing

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.

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

General folders layout

src

  • source code

tests

  • unit-tests

Package development lifecycle

  • 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

Maintainers

github.maintain@byndyusoft.com

About

Provides extension methods for System.Net.Http.HttpClient and System.Net.Http.HttpContent that perform automatic serialization and deserialization using System.Text.Json.

Topics

Resources

License

Stars

Watchers

Forks

Languages