Home

Awesome

HttpClientGoodies.NET

Build status NuGet

A set of useful utilities for the .NET HttpClient.

Installation

Install-Package HttpClientGoodies

What's it for?

These small but useful utilities will make your HttpClient life worth living.

Fastest way to profit

Here's an example of sending JSON content and reading JSON content in the least amount of code possible, while also providing Basic Authentication.

var dataToSend = new Todo {
    Text = 'Install this package'
};

var createdTodo = await RequestBuilder.Post('http://api.todos.com/todos/{id}')
    .BasicAuthentication("username", "password")
    .AddUrlSegment("id", 123)
    .JsonContent(dataToSend)
    .SendAsync()
    .AsJson<Todo>();

Console.WriteLine(createdTodo.Text);

That's cool, what else can it do?

Quite a lot! All methods that build the request are chainable! Let's asume the following for each snippet:

var builder = new RequestBuilder();

Author

Jeff Hansen - @Jeffijoe