Fluent.Client
1.1.0
dotnet add package Fluent.Client --version 1.1.0
NuGet\Install-Package Fluent.Client -Version 1.1.0
<PackageReference Include="Fluent.Client" Version="1.1.0" />
<PackageVersion Include="Fluent.Client" Version="1.1.0" />
<PackageReference Include="Fluent.Client" />
paket add Fluent.Client --version 1.1.0
#r "nuget: Fluent.Client, 1.1.0"
#:package Fluent.Client@1.1.0
#addin nuget:?package=Fluent.Client&version=1.1.0
#tool nuget:?package=Fluent.Client&version=1.1.0
<div align="center"> <h1>๐ Fluent.Client</h1> <h3><em>A fluent HTTP client wrapper for .NET.</em></h3> </div>
<p align="center"> <strong>Build HTTP requests with a clean, chainable API. Less boilerplate, more productivity.</strong> </p>
<p align="center"> <a href="https://www.nuget.org/packages/Fluent.Client"><img src="https://img.shields.io/nuget/v/Fluent.Client.svg" alt="NuGet"/></a> <a href="https://www.nuget.org/packages/Fluent.Client"><img src="https://img.shields.io/nuget/dt/Fluent.Client.svg" alt="NuGet Downloads"/></a> <a href="https://github.com/lepoco/fluent/stargazers"><img src="https://img.shields.io/github/stars/lepoco/fluent?style=social" alt="GitHub stars"/></a> <a href="https://github.com/lepoco/fluent/blob/main/LICENSE"><img src="https://img.shields.io/github/license/lepoco/fluent" alt="License"/></a> </p>
<p align="center"> <a href="https://lepo.co/">Created in Poland by Leszek Pomianowski</a> and <a href="https://github.com/lepoco/fluent/graphs/contributors">open-source community</a>. </p>
Table of Contents
- Table of Contents
- ๐ค Why This Library?
- โก Get Started
- ๐ How to Use
- ๐ API Reference
- ๐งช Testing with AwesomeAssertions
- ๐ฅ Maintainers
- ๐ฌ Support
- ๐ License
๐ค Why This Library?
Traditional HttpClient usage requires verbose setup:
// โ Traditional approach - verbose and repetitive
var request = new HttpRequestMessage(HttpMethod.Post, "/api/users");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Content = new StringContent(
JsonSerializer.Serialize(new { Name = "John" }),
Encoding.UTF8,
"application/json");
var response = await client.SendAsync(request);
With Fluent.Client, requests become expressive one-liners:
// โ
Fluent approach - clean and readable
var response = await client
.Authorize(token: "abc123")
.Post("/api/users", new { Name = "John" })
.SendAsync();
โก Get Started
Install the Package
dotnet add package Fluent.Client
๐ฆ NuGet: https://www.nuget.org/packages/Fluent.Client
Quick Example
using Fluent.Client;
var client = new HttpClient { BaseAddress = new Uri("https://api.example.com/") };
// Simple POST with JSON body
var response = await client
.Post("/api/users", new { Name = "John Doe" })
.SendAsync();
๐ How to Use
1. Create a Request
Start by creating a request using one of the HTTP method extensions on HttpClient.
using Fluent.Client;
var client = new HttpClient { BaseAddress = new Uri("https://api.example.com/") };
// POST with JSON body
var request = client.Post("/api/v1/users", new { Name = "John Doe" });
// GET with query parameters
var request = client.Get("/api/v1/users", new { page = 1, limit = 10 });
// DELETE
var request = client.Delete("/api/v1/users/897");
// PUT with body
var request = client.Put("/api/v1/users/897", new { Name = "Jane Doe" });
Available HTTP Methods
| Method | Description |
|---|---|
.Get(path, query?) |
Create GET request with optional query parameters |
.Post(path, body?) |
Create POST request with optional JSON body |
.Put(path, body?) |
Create PUT request with optional JSON body |
.Delete(path) |
Create DELETE request |
.Patch(path, body?) |
Create PATCH request with optional JSON body |
2. Configure the Request
Chain configuration methods to add headers, authorization, and more.
Authorization
// Bearer token
client.Authorize(token: "jwt-token-here").Get("/api/protected");
// Basic authentication
client.Authorize(username: "john", password: "secret").Get("/api/protected");
Query Parameters
// Pass as anonymous object
client.Get("/api/users", new
{
page = 1,
limit = 10,
sortBy = "createdAt"
});
Chaining Multiple Configurations
var request = client
.Authorize(token: "abc123")
.Get("/api/v1/basket", new { includeItems = true });
3. Send the Request
Send the request and handle the response.
<details open> <summary><strong>Get HttpResponseMessage</strong></summary>
using HttpResponseMessage response = await request.SendAsync();
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
</details>
<details> <summary><strong>Deserialize Response Automatically</strong></summary>
// Automatically deserialize JSON response to typed object
UserCreatedResponse result = await request.SendAsync<UserCreatedResponse>();
Console.WriteLine($"Created user: {result.Id}");
</details>
<details> <summary><strong>Direct Execution (No SendAsync)</strong></summary>
// The request returns Task<HttpResponseMessage>, so you can await directly
using var response = await client
.Authorize(token: "abc123")
.Post("/api/users", new { Name = "John" });
</details>
๐ API Reference
Request Creation Methods
| Method | Description |
|---|---|
Get(path, query?) |
Create GET request |
Post(path, body?) |
Create POST request |
Put(path, body?) |
Create PUT request |
Delete(path) |
Create DELETE request |
Patch(path, body?) |
Create PATCH request |
Configuration Methods
| Method | Description |
|---|---|
Authorize(token) |
Add Bearer token authorization |
Authorize(username, password) |
Add Basic authentication |
Execution Methods
| Method | Description |
|---|---|
SendAsync() |
Send request and return HttpResponseMessage |
SendAsync<T>() |
Send request and deserialize response to T |
๐งช Testing with AwesomeAssertions
Pair this library with Fluent.Client.AwesomeAssertions for expressive test assertions:
await client
.Authorize(token: "abc123")
.Post("/api/users", new { Name = "John" })
.Should()
.Succeed("because valid user data was provided");
๐ฆ Install: dotnet add package Fluent.Client.AwesomeAssertions
๐ฅ Maintainers
- Leszek Pomianowski (@pomianowski)
๐ฌ Support
For support, please open a GitHub issue. We welcome bug reports, feature requests, and questions.
๐ License
This project is licensed under the terms of the MIT open source license. Please refer to the LICENSE file for the full terms.
You can use it in private and commercial projects. Keep in mind that you must include a copy of the license in your project.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net472 is compatible. net48 was computed. net481 is compatible. |
-
.NETFramework 4.7.2
- System.Text.Json (>= 6.0.11)
-
.NETFramework 4.8.1
- System.Text.Json (>= 6.0.11)
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 39 | 3/5/2026 |
| 1.0.2 | 129 | 2/6/2026 |
| 1.0.1 | 129 | 1/10/2026 |
| 1.0.0 | 99 | 1/9/2026 |
| 1.0.0-preview.2 | 83 | 1/9/2026 |
| 1.0.0-preview.1 | 57 | 1/9/2026 |