Soenneker.StartupFilters.IntegrationTests 4.0.121

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

Soenneker.StartupFilters.IntegrationTests

An ASP.NET Core startup filter that makes in-memory integration-test requests appear to originate from the loopback address.

Installation

dotnet add package Soenneker.StartupFilters.IntegrationTests

Usage with WebApplicationFactory

using Microsoft.AspNetCore.Mvc.Testing;
using Soenneker.StartupFilters.IntegrationTests.Registrars;

await using var factory = new WebApplicationFactory<Program>()
    .WithWebHostBuilder(builder =>
    {
        builder.ConfigureServices(services =>
        {
            services.AddIntegrationTestsStartupFilterAsSingleton();
        });
    });

using HttpClient client = factory.CreateClient();
HttpResponseMessage response = await client.GetAsync("/health");

The filter inserts LocalIpAddressMiddleware before the application's configured pipeline. For every request, that middleware sets both HttpContext.Connection.LocalIpAddress and RemoteIpAddress to IPAddress.Loopback. This is useful when code under test requires connection-address data that an in-memory test server does not provide.

Test-only safety

Do not register this package in production. Replacing RemoteIpAddress can bypass application behavior that trusts loopback traffic, including IP allowlists or local-only endpoints. Keep the registration inside the integration-test host configuration rather than shared application startup.

The singleton registration is the normal choice because startup filters are consumed while the host builds its middleware pipeline. The scoped registrar is available for specialized hosts, but it is not needed for a standard WebApplicationFactory setup.

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

Showing the top 2 NuGet packages that depend on Soenneker.StartupFilters.IntegrationTests:

Package Downloads
Soenneker.Fixtures.Integration

Provides a reusable and generic integration test xunit fixture that dynamically registers and configures WebApplicationFactory instances for multiple ASP.NET Core projects with support for custom app settings, authentication, logging, and test utilities.

Soenneker.TestHosts.Integration

Provides a reusable and generic integration test host that dynamically registers and configures WebApplicationFactory instances for multiple ASP.NET Core projects with support for custom app settings, authentication, logging, and test utilities.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.121 50 8/30/2026
4.0.120 30 8/30/2026
4.0.119 148 8/30/2026
4.0.118 87 8/29/2026
4.0.117 37 8/29/2026
4.0.116 39 8/29/2026
4.0.115 1,051 8/11/2026
4.0.114 738 7/28/2026
4.0.113 182 7/27/2026
4.0.112 833 7/16/2026
4.0.111 107 7/16/2026
4.0.110 1,450 6/19/2026
4.0.109 148 6/18/2026
4.0.108 780 6/9/2026
4.0.107 666 6/5/2026
4.0.106 126 6/5/2026
4.0.104 922 5/12/2026
4.0.102 2,085 3/12/2026
4.0.101 124 3/12/2026
4.0.98 140 3/12/2026
Loading failed

Update dependency Soenneker.Middlewares.LocalIpAddress to 4.0.68 (#659)