SpanFlow.Connectors.Http 1.0.0

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

SpanFlow.Connectors.Http

Builds HTTP requests from a JSON description, the way an API tool does, and signs them with common API authentication schemes. It comes from SpanFlow, where it handles every HTTP call a pipeline makes.

Authentication schemes (IAuthStrategy, chosen by auth.type):

type Scheme
none, apiKey (in a header, query or cookie), basic, bearer Static credentials
oauth2ClientCredentials, tokenEndpoint, loginRequest A token that is fetched, cached and renewed before it expires
digest HTTP Digest (RFC 7616: MD5 or SHA-256, qop=auth)
hawk Hawk, with payload hashing
oauth1 OAuth 1.0a (HMAC-SHA1/256/512, RSA-SHA1/256/512 or PLAINTEXT; in the header, query or form body)
jwtBearer A JWT you sign (HS, RS, PS or ES with 256, 384 or 512), sent as a bearer token
using System.Text.Json.Nodes;
using SpanFlow.Connectors.Http;
using SpanFlow.Connectors.Http.Auth;

var request = JsonNode.Parse("""
{
  "method": "POST",
  "path": "/v1/orders",
  "query": { "dryRun": "true" },
  "headers": { "X-Request-Id": "abc-123" },
  "bodyType": "json",
  "body": { "sku": "A-1", "qty": 2 }
}
""")!.AsObject();

var settings = HttpRequestSettings.Default;
using var message = new HttpRequestMessage(HttpMethod.Post, HttpRequestBuilder.BuildUri("https://api.example.com", request, settings))
{
    Content = HttpRequestBuilder.BuildContent(request, explicitBody: null),
};
HttpRequestBuilder.ApplyHeaders(message, new Dictionary<string, string>(), request, settings);

// Sign it. The static registry holds the schemes that need no token store or IHttpClientFactory.
var auth = JsonNode.Parse("""{ "type": "hawk", "authId": "id1", "authKey": "a-shared-key" }""")!.AsObject();
await AuthStrategyRegistry.CreateStatic().Get("hawk").ApplyAsync(message, auth, CancellationToken.None);

The token-based schemes take an IHttpClientFactory and a TokenCache. To share tokens across processes, give them your own ISharedTokenStore. HttpThrottleRegistry spaces out calls to each host.

Targets .NET 8, 9 and 10. MIT licensed.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 94 11/9/2026