Albatross.Http 2.0.3

Prefix Reserved
dotnet add package Albatross.Http --version 2.0.3
                    
NuGet\Install-Package Albatross.Http -Version 2.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Albatross.Http" Version="2.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Albatross.Http" Version="2.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Albatross.Http" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Albatross.Http --version 2.0.3
                    
#r "nuget: Albatross.Http, 2.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Albatross.Http@2.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Albatross.Http&version=2.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Albatross.Http&version=2.0.3
                    
Install as a Cake Tool

Albatross.Http

A companion library for HttpClient that simplifies building HTTP requests, executing them with typed error handling, and streaming responses. Designed for use with IHttpClientFactory and code-generated HTTP clients.

Key Features

  • RequestBuilder - Fluent API for constructing HttpRequestMessage with JSON, text, stream, form, and multipart form data content.
  • RequestBuilderExtensions - Extension methods for optional query string parameters with AddQueryStringIfSet<T>, including automatic ISO8601 formatting for date/time types.
  • Typed Execute methods - Send requests and deserialize responses with automatic error handling via ServiceException<T>. Includes Send, Execute, ExecuteOrThrow, ExecuteOrThrowStruct, and ExecuteAsStream with simplified overloads that default the error type to string.
  • Streaming support - ExecuteAsStream for consuming IAsyncEnumerable endpoints with true streaming via HttpCompletionOption.ResponseHeadersRead.
  • URL utilities - Query string building, URL batching for large array parameters, relative URI resolution, and ISO8601 formatting helpers.
  • DefaultJsonSerializerOptions - Shared JsonSerializerOptions with camelCase naming and null-ignoring behavior.
  • Structured logging - LoggingHandler integrates with ILogger for HTTP request/response logging.

Quick Start

Install the package:

dotnet add package Albatross.Http

Build and execute a request:

using Albatross.Http;

// Build a request
var request = new RequestBuilder()
    .WithMethod(HttpMethod.Get)
    .WithRelativeUrl("api/items")
    .AddQueryString("category", "books")
    .Build();

// Execute with typed error handling
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
var result = await httpClient.Execute<Item[]>(request, options, cancellationToken);

Stream results from an IAsyncEnumerable endpoint:

var request = new RequestBuilder()
    .WithMethod(HttpMethod.Get)
    .WithRelativeUrl("api/items/stream")
    .Build();

await foreach (var item in httpClient.ExecuteAsStream<Item, string>(request, options, cancellationToken)) {
    Console.WriteLine(item);
}

Register the logging handler with IHttpClientFactory:

services.AddTransient<LoggingHandler>();
services.AddHttpClient("MyApi")
    .AddHttpMessageHandler<LoggingHandler>();

Dependencies

Source Code

Nuget Packages

Name Version
Albatross.Http NuGet Version
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.0.3 121 10/26/2026
2.0.2 170 9/13/2026
2.0.2-rc.49 92 7/31/2026
2.0.1 149 6/27/2026
2.0.0-38.main 61 6/27/2026
2.0.0-36.main 58 6/23/2026
1.0.1-35.main 62 6/23/2026
1.0.0 99 2/12/2026
1.0.0-29.main 86 2/2/2026
1.0.0-28.main 86 1/29/2026
1.0.0-12.main 74 1/27/2026