Install
dotnet add package Nullean.Snapshots.Http.Assertions --version 0.12.2
| Product | Versions |
|---|---|
| .NET |
README
Nullean.Snapshots.Http.Assertions

AwesomeAssertions extensions for Nullean.Snapshots.Http: MatchHttpSnapshot for a response, MatchHttpFileSnapshot and HttpFileTest for .http files, compared as trees with secrets redacted.
Install
dotnet add package Nullean.Snapshots.Http.Assertions
Quick start
using AwesomeAssertions;
using Nullean.Snapshots;
using Nullean.Snapshots.Http;
using Nullean.Snapshots.TUnit;
public class OrdersApiTests
{
private static readonly HttpClient Client = new() { BaseAddress = new Uri("http://localhost:5000/") };
[Test]
public async Task GetsAnOrder()
{
using var response = await Client.GetAsync("/api/orders/3");
await response.Should().MatchHttpSnapshot(); // status, chosen headers, JSON body as a tree
}
[Test]
[HttpFiles("http")] // one test case per .http file
public Task Run(SnapshotFile file) =>
HttpFileTest.RunAsync(file, new HttpFileSnapshotOptions { Client = Client });
}
[HttpFiles] is in Nullean.Snapshots.TUnit. For WebApplicationFactory, give the runner a client that does
not follow redirects, factory.CreateClient(new() { AllowAutoRedirect = false }), so # @no-redirect works per
request; HttpFileTest.SkipReason says when a file does not apply.
Learn more
- Documentation: https://snapshots.nullean.net
- HTTP snapshots: https://snapshots.nullean.net/formats/http/
- Source and issues: https://github.com/nullean/snapshots
Changes from Previous Version
v0.12.1v0.12.2
Added Frameworks
net11.0
Added Dependencies
Nullean.Snapshots.AwesomeAssertions(net11.0)
Nullean.Snapshots.Http(net11.0)
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.