ProtoTest.Http
1.0.1
dotnet add package ProtoTest.Http --version 1.0.1
NuGet\Install-Package ProtoTest.Http -Version 1.0.1
<PackageReference Include="ProtoTest.Http" Version="1.0.1" />
<PackageVersion Include="ProtoTest.Http" Version="1.0.1" />
<PackageReference Include="ProtoTest.Http" />
paket add ProtoTest.Http --version 1.0.1
#r "nuget: ProtoTest.Http, 1.0.1"
#:package ProtoTest.Http@1.0.1
#addin nuget:?package=ProtoTest.Http&version=1.0.1
#tool nuget:?package=ProtoTest.Http&version=1.0.1
ProtoTest.Http
Shared HTTP client plumbing and the [Auth<T>] model behind REST, GraphQL and gRPC — an extension point for protocol authors, normally transitive.
dotnet add package ProtoTest.Http
Application tests reference ProtoTest.Rest or ProtoTest.GraphQL, which bring this package in; build directly on it only when writing an HTTP-based protocol integration.
Quick start
// A protocol package registers its keyed options once, under its own section.
ProtoHttpOptionsRegistration.ConfigureResponseOptions(
services,
protocolName: "Widgets",
configurationSectionName: "ProtoTest:Widgets:Responses",
options => options.MaxResponseBodyBytes = 5 * 1024 * 1024);
// The running test resolves them through the shared execution context.
var options = context.ResolveResponseOptions("Widgets");
// Named clients are created through IHttpClientFactory and traced as client entities.
services.AddSingleton<IProtoClientInitializer<HttpClient>>(
new ProtoHttpClientInitializer("Widgets", "Default", explicitBaseUrl: "https://widgets.example.test"));
var resolution = ProtoHttpClientResolver.Resolve(context, "Widgets");
What it adds
- Client initialization —
ProtoHttpClientInitializerresolves an address from the explicit argument,ProtoTest:Applications:{application}:BaseUrl(joined withEndpoints:{name}), or the application's in-process transport. - Response options —
ProtoHttpResponseOptions(MaxResponseBodyBytes10 MiB,MaxDiagnosticBodyLength64 KiB); register withTryAddResponseOptions/ConfigureResponseOptionsand read withResolveResponseOptions. - Attachment options —
ProtoHttpAttachmentOptions(capture flags, redaction and sensitive header/query/JSON lists); read withResolveAttachmentOptions, which returnsnullwhen the protocol never opted in. - Buffering —
ProtoHttpResponseBuffer.BufferAsyncenforces the limit and throwsProtoResponseTooLargeException; the content is replaced with a readable buffered copy. - Authentication —
IProtoHttpAuthenticator,[Auth<T>],BearerTokenAuthenticator,BasicAuthAuthenticator,ApiKeyAuthenticatorandProtoCompositeHttpAuthenticator. - Diagnostics —
ProtoHttpDiagnosticSanitizerredacts JSON/form/multipart/XML bodies, headers and URIs; header values are never traced.
Responses are buffered in full in memory and the package has no retry policy; TryAddResponseOptions is first-wins.
Learn more
| Product | Versions 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. |
-
net10.0
- Microsoft.Extensions.Http (>= 10.0.12)
- ProtoTest.Core (>= 1.0.1)
- ProtoTest.Json (>= 1.0.1)
-
net8.0
- Microsoft.Extensions.Http (>= 8.0.1)
- ProtoTest.Core (>= 1.0.1)
- ProtoTest.Json (>= 1.0.1)
-
net9.0
- Microsoft.Extensions.Http (>= 9.0.20)
- ProtoTest.Core (>= 1.0.1)
- ProtoTest.Json (>= 1.0.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on ProtoTest.Http:
| Package | Downloads |
|---|---|
|
ProtoTest.Rest
Runner-independent REST integration testing for ProtoTest. |
|
|
ProtoTest.Grpc
gRPC integration for ProtoTest: named channels, metadata authentication, unary and streaming helpers, tracing and coverage. |
|
|
ProtoTest.OpenApi
OpenAPI contract coverage for ProtoTest REST tests. |
|
|
ProtoTest.GraphQL
Fluent, runner-independent GraphQL integration testing for ProtoTest. |
GitHub repositories
This package is not used by any popular GitHub repositories.