Franz.Common.Http.Client 3.0.0

dotnet add package Franz.Common.Http.Client --version 3.0.0
                    
NuGet\Install-Package Franz.Common.Http.Client -Version 3.0.0
                    
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="Franz.Common.Http.Client" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Franz.Common.Http.Client" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Franz.Common.Http.Client" />
                    
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 Franz.Common.Http.Client --version 3.0.0
                    
#r "nuget: Franz.Common.Http.Client, 3.0.0"
                    
#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 Franz.Common.Http.Client@3.0.0
                    
#: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=Franz.Common.Http.Client&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Franz.Common.Http.Client&version=3.0.0
                    
Install as a Cake Tool

Franz.Common.Http.Client

A named-HttpClient-backed base service for outbound HTTP calls, request construction, serialization, and multipart content.

Overview

A named-HttpClient-backed base service for outbound HTTP calls, request construction, serialization, and multipart content.

Installation

dotnet add package Franz.Common.Http.Client

Registration

The package exposes AddHttpServices(IConfiguration, TimeSpan, Func<Assembly, bool>?) in Franz.Common.Http.Client.Extensions.

using Franz.Common.Http.Client.Extensions;

builder.Services.AddHttpServices(
    builder.Configuration,
    TimeSpan.FromSeconds(30),
    assembly => assembly.GetName().Name?.StartsWith("MyCompany.", StringComparison.Ordinal) == true);

When no predicate is supplied, discovery targets assemblies whose names start with the configured Franz company/product-generation prefix and end with .ClientHttp. For each matching assembly, registration derives a named client identifier from the assembly name and requires:

{
  "HttpServices": {
    "MyCompany.Orders": {
      "BaseAddress": "https://orders.example.net/",
      "Timeout": "00:00:30"
    }
  }
}

The BaseAddress setting is mandatory for each discovered client. The method-level timeout is applied first; a valid per-client Timeout setting overrides it. Invalid or missing base-address configuration fails registration with a TechnicalException.

Registration also adds the package's request-builder and exception delegating handlers, registers serializers, and adds a transient HttpClient registration. Use the factory-managed named clients rather than creating clients manually.

Implement an HttpService

HttpService is abstract. A concrete service derives from it and uses the protected request methods. Its constructor resolves the named client associated with the concrete service's assembly-derived namespace.

using Franz.Common.Http.Client;

public sealed class OrdersClient : HttpService
{
    public OrdersClient(
        IHttpClientFactory factory,
        IEnumerable<Newtonsoft.Json.JsonConverter> converters)
        : base(factory, converters) { }

    public Task<OrderDto> GetOrderAsync(Guid id, CancellationToken ct) =>
        GetRequestAsync<OrderDto>($"orders/{id}", ct);
}

The base class provides GET, POST, PUT, and DELETE helpers, typed and untyped responses, cancellation-token-aware asynchronous overloads, request headers, and multipart form-data support. It also exposes query-parameter and multipart-parameter generation helpers for derived clients.

Prefer the asynchronous methods and pass the caller's cancellation token. Synchronous wrappers block on asynchronous work and should not be used in request paths.

Request and response behavior

  • Requests use the configured HttpClient and the package's configured JSON converters.
  • Non-success responses are checked by the internal send path; inspect the concrete exception contract before translating failures at the application boundary.
  • Header values are serialized before being added to HttpRequestMessage.Headers.
  • Multipart helpers support ordinary content parameters and file parameters.
  • Download helpers return a temporary-file-backed stream; dispose it to remove the backing file.

Ownership

HttpService implements IDisposable and disposes its internally created client. Keep the service lifetime aligned with the factory-created client usage in the application. Do not share mutable request state between concurrent operations.

Important boundaries

This package is not a generic Refit adapter and does not itself define authentication policy. Use the dedicated Refit package for typed Refit clients. Configure credentials and request headers deliberately; never place secrets in configuration files committed to source control.

License

MIT. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET 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
3.0.0 50 11/10/2026
2.3.4 336 11/1/2026
2.3.3 313 10/28/2026
2.3.2 105 10/27/2026
2.3.1 163 10/26/2026
2.3.0 228 7/21/2026
2.2.19 126 7/19/2026
2.2.18 152 7/19/2026
2.2.17 134 7/12/2026
2.2.16 143 7/2/2026
2.2.15 134 6/29/2026
2.2.14 129 6/29/2026
2.2.13 134 6/29/2026
2.2.12 129 6/28/2026
2.2.11 123 6/28/2026
2.2.10 125 6/28/2026
2.2.9 146 6/28/2026
2.2.8 125 6/28/2026
2.2.7 136 6/7/2026
2.2.6 130 6/6/2026
Loading failed