ProtoTest.Rest 1.0.1

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

ProtoTest.Rest

A per-test HTTP client with route and query expansion, the shared [Auth<T>] pipeline, JSON shape assertions, capture and endpoint coverage.

dotnet add package ProtoTest.Rest

Quick start

builder.AddApplication("Api", app => app.AddRest(rest => rest
    .AddClient("Orders")));   // joins the application's BaseUrl with Endpoints:Orders

[Application("Api", "Rest:Orders")]
[Auth<BearerTokenAuthenticator>("token")]
public sealed class OrderTests
{
    [ProtoTest]
    public async Task GetOrder()
    {
        using var response = await Proto.Context.Rest()
            .GetAsync("/orders/{id}", new { id = 42 });

        response.Should.HaveHttpStatus(HttpStatusCode.OK)
            .ShouldMatchShape(new
            {
                id = 42,
                status = JsonValue.NotNull()
            });
    }
}

What it adds

  • ClientsProto.Context.Rest(name?) resolves a named HttpClient; AddClient accepts an explicit base URL, an endpoint name or a per-test Func<ProtoExecutionContext, Uri> resolver, and AddClientFrom reuses another integration's transport.
  • RequestsHeader, Body (object, raw, bytes or a content factory) and the verb helpers; {route} tokens and leftover properties expand into the route and query string.
  • Assertionsresponse.Should.HaveHttpStatus(...), ShouldNot.HaveHttpStatus(...) and ShouldMatchShape(...); failures carry RestStatusAssertionException or JsonShapeMismatchException.
  • Authentication — the shared [Auth<T>] pipeline plus per-request Auth(...)/WithoutAuth(), with built-in bearer, basic and API-key authenticators.
  • Capture and coverageCaptureAttachments() records redacted request/response bodies; RestCoverageCollector reports endpoints from http.response observations.
  • Tracinghttp.request operations with request/response sections, http.response/http.failure observations and assert.http.status/assert.json.shape checks.

Configuration

Under ProtoTest:Rest:Responses and ProtoTest:Rest:Attachments; code callbacks (ConfigureResponses, CaptureAttachments) run first and configuration is bound over them.

Key Type Default
MaxResponseBodyBytes int 10485760 (10 MiB)
MaxDiagnosticBodyLength int 65536
CaptureRequestBodies bool true
CaptureResponses bool true
CaptureExpectedShapes bool true
RedactSensitiveData bool true
SensitiveHeaders List<string> Authorization, Proxy-Authorization, Cookie, Set-Cookie, X-Api-Key
SensitiveQueryParameters List<string> access_token, refresh_token, token, apiKey, api_key, key
SensitiveJsonProperties List<string> password, token, access_token, refresh_token, secret, apiKey, api_key

Shape assertions are positive-only; response bodies are always buffered in full and there is no retry policy.

Learn more

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 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on ProtoTest.Rest:

Package Downloads
ProtoTest.OpenApi

OpenAPI contract coverage for ProtoTest REST tests.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 48 9/20/2026
1.0.0 56 9/20/2026