Skip to content

HTTP client ​

HttpTransaction is the primary entry point: verb helpers over a pooled HttpClient pool, with cookies, multipart/form helpers, and snapshot inspection.

Basic GET / POST ​

csharp
using JASE.Network;

HttpTransaction get = await HttpTransaction.Get(
    "https://example.com/health",
    cancellationToken: cancellationToken);

Console.WriteLine(get.StatusCode);
string body = get.Content;

HttpTransaction post = await HttpTransaction.Post(
    "https://httpbin.org/post",
    "application/json",
    "MyApp/1.0",
    headers: null,
    """{"ok":true}""",
    cancellationToken: cancellationToken);

Also available: Head, Delete, and related helpers. Prefer passing CancellationToken on every call.

Pooling ​

Clients are pooled by host/policy. You can tune max connections per server:

csharp
HttpTransaction.SetMaxConnections("https://api.example.com", maxConnections: 8);

Use pooling when many concurrent calls share origins. Avoid creating ad-hoc HttpClient instances beside this stack for the same hosts — you will fight socket exhaustion and lose shared policy.

Forms and multipart ​

FormDataCollection, FilePost, and boundary helpers support multipart uploads. See /api/network/ for FormDataCollection and related types.

OAuth helpers ​

Token request helpers for client-credentials, password, and generic grant types ship in the same package — useful when a host needs tokens without standing up a full identity stack.