Soenneker.Extensions.HttpRequestMessage 4.0.1401

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

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Extensions.HttpRequestMessage

Extension methods for copying, inspecting, and preparing HttpRequestMessage instances for sending, retrying, and diagnostics.

Installation

dotnet add package Soenneker.Extensions.HttpRequestMessage

Usage

using Soenneker.Extensions.HttpRequestMessage;

using var original = new HttpRequestMessage(HttpMethod.Post, "https://api.example.com/orders")
{
    Content = JsonContent.Create(order)
};

using HttpRequestMessage retry = await original.Clone(cancellationToken: cancellationToken);

using HttpResponseMessage firstResponse = await httpClient.SendAsync(original, cancellationToken);

if (!firstResponse.IsSuccessStatusCode)
{
    retry.Headers.Add("X-Retry", "1");
    using HttpResponseMessage retryResponse = await httpClient.SendAsync(retry, cancellationToken);
}

Create every clone before sending the original when its content may be backed by a non-seekable stream. Each request message can then be sent once.

Clone() copies the method, URI, HTTP version and version policy, request headers, options, and content headers/body. The body is buffered independently, so disposing or consuming one request does not consume the other's body. Transport state associated with a request that has already been sent is not copied.

Option values are copied by reference. If an option contains a mutable object, the original and clone still share that object.

An application already using pooled memory streams can pass its scoped utility while retaining ownership of the long-lived client:

using HttpRequestMessage copy = await request.Clone(memoryStreamUtil, cancellationToken);

The method returns ValueTask<HttpRequestMessage>. It completes synchronously when there is no content; content cloning is asynchronous and honors cancellation. The caller owns and must dispose the returned request. Passing null throws ArgumentNullException.

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 (1)

Showing the top 1 NuGet packages that depend on Soenneker.Extensions.HttpRequestMessage:

Package Downloads
Soenneker.Extensions.HttpClient

A collection of helpful HttpClient extension methods, like retry and auto (de)serialization

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.1401 34 9/13/2026
4.0.1400 285 9/13/2026
4.0.1399 38 9/13/2026
4.0.1398 396 9/12/2026
4.0.1397 161 9/12/2026
4.0.1396 43 9/12/2026
4.0.1395 49 9/12/2026
4.0.1394 957 9/9/2026
4.0.1393 425 9/9/2026
4.0.1392 576 9/8/2026
4.0.1391 708 9/8/2026
4.0.1390 985 9/7/2026
4.0.1389 1,907 9/5/2026
4.0.1388 450 9/4/2026
4.0.1387 269 9/4/2026
4.0.1385 1,308 9/4/2026
4.0.1384 1,267 9/1/2026
4.0.1383 906 8/31/2026
4.0.1382 467 8/31/2026
4.0.1381 552 8/31/2026
Loading failed

Updated NuGet packages

NuGet-Builder-Operation: 24bf02617ced44c0a3fe13df9544251c