HttpClientGoodies alternatives and similar packages
Based on the "HTTP" category.
Alternatively, view HttpClientGoodies alternatives based on common mentions on social networks and blogs.
-
Refit
The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface. -
Flurl.Http
Fluent URL builder and testable HTTP client for .NET -
WebApiClient
An open source project based on the HttpClient. You only need to define the c# interface and modify the related features to invoke the client library of the remote http interface asynchronously. -
FastEndpoints
A light-weight REST API development framework for ASP.Net 6 and newer. [Moved to: https://github.com/FastEndpoints/Library] -
RestEase
Easy-to-use typesafe REST API client library for .NET Standard 1.1 and .NET Framework 4.5 and higher, which is simple and customisable. Inspired by Refit -
Simple.OData.Client
Multiplatform OData client library -
FluentUriBuilder
A safer and more readable way to build URI's in .NET -
RestLess
The automatic type-safe-reflectionless REST API client library for .Net Standard -
Apizr
Refit based web api client management, but resilient (retry, connectivity, cache, auth, log, priority, etc...) -
CoreRPC
Extensible RPC library with Typescript client generator -
Cashew
A simple and elegant yet powerful HTTP client cache for .NET -
Lib.Net.Http.WebPush
Lib.Net.Http.WebPush is a library which provides a Web Push Protocol based client for Push Service. -
Lib.Net.Http.EncryptedContentEncoding
Lib.Net.Http.EncryptedContentEncoding is a library which adds Encrypted Content-Encoding (aes128gcm) support to HttpClient -
Sandwych.JsonRpc
Sandwych.JsonRpc: A JSON-RPC Client For .NET
Access the most powerful time series database as a service
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of HttpClientGoodies or a related project?
README
HttpClientGoodies.NET
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();
- Headers:
builder.AddHeader("X-MyHeader", "cool value");
- Query parameters
builder.AddQuery("searchText", "how do i get my girlfriend to tape her fingers together like a dinosaur");
- Base URI + Resource URI separately
builder.BaseUri("http://todos.com")
.ResourceUri("api/todos");
- URL segments
builder.BaseUri("http://todos.com")
.ResourceUri("api/todos/{id}")
.AddUrlSegment("id", 123);
- Authentication
builder.Authentication("Basic", "<some base64 here>");
// Basic auth shortcut (will base64 for you!)
builder.BasicAuthentication("username", "password");
- Setting content
builder.Content(new HttpStringContent("hehehe"));
// Want to send JSON?
builder.Content(new JsonContent(new Todo()));
// Can do you one better!
builder.JsonContent(new Todo());
- HTTP method
builder.Method(HttpMethod.Get);
- Getting the
HttpRequestMessage
to send
var message = builder.ToHttpRequestMessage();
await someClient.SendAsync(message);
- Sending the request without manually calling
ToHttpRequestMessage
var response = await builder.SendAsync();
// if you have a client instance you can pass it in.
var response = await builder.SendAsync(client);
- Reading content as JSON
var response = await builder.SendAsync();
var todo = await response.Content.ReadAsJsonAsync<Todo>();
// Even better...
var todo = await builder.SendAsync().AsJson<Todo>();
// Custom settings? No problemo!
var settings = new JsonSerializerSettings();
var todo = await response.Content.ReadAsJsonAsync<Todo>(settings);
var todo = await builder.SendAsync().AsJson<Todo>(settings);
- Shortcuts for methods
The following static methods are available: Get
, Post
, Put
, Patch
, Delete
, Head
, Options
, Trace
.
var todo = await RequestBuilder
.Get('http://todos.com/api/todos/123')
.SendAsync()
.AsJson<Todo>();
Author
Jeff Hansen - @Jeffijoe