Unfucked.HTTP
0.0.1-beta.42
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
This is a prerelease version of Unfucked.HTTP.
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Unfucked.HTTP --version 0.0.1-beta.42
NuGet\Install-Package Unfucked.HTTP -Version 0.0.1-beta.42
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="Unfucked.HTTP" Version="0.0.1-beta.42" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Unfucked.HTTP" Version="0.0.1-beta.42" />
<PackageReference Include="Unfucked.HTTP" />
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 Unfucked.HTTP --version 0.0.1-beta.42
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Unfucked.HTTP, 0.0.1-beta.42"
#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 Unfucked.HTTP@0.0.1-beta.42
#: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=Unfucked.HTTP&version=0.0.1-beta.42&prerelease
#tool nuget:?package=Unfucked.HTTP&version=0.0.1-beta.42&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
🧰 Unfucked.HTTP
Fix egregiously missing or broken functionality in HttpClient. Inspired by JAX-RS and Jersey Client.
Installation
dotnet package add Unfucked.HTTP
using Unfucked;
using Unfucked.HTTP;
Configuration
- Drop-in subclasses of
HttpClientandHttpMessageHandler, and extension methodsusing HttpClient http = new UnfuckedHttpClient(); // set the subclass// custom handlers are wrapped automatically using HttpClient http = new UnfuckedHttpClient(new SocketsHttpHandler() { UseCookies = true });
Usage
- Immutable builder pattern for HTTP request URLs, headers, verbs, and response representations that is fluent, composable, and avoids accidentally reusing stale state and sending to corrupted URLs
JsonNode responseBody = await http.Target("https://httpbin.org") .Path("get") .Accept(MediaTypeNames.Application.Json) .Get<JsonNode>(); - Request and response filtering
http.Register(new PrintRequests()); http.Register(new PrintResponses()); class PrintRequests: ClientRequestFilter { public async ValueTask<HttpRequestMessage> Filter(HttpRequestMessage request, CancellationToken cancellationToken) { Console.WriteLine(">> {0} {1}", request.Method, request.RequestUri); return request; } } class PrintResponses: ClientResponseFilter { public async ValueTask<HttpResponseMessage> Filter(HttpResponseMessage response, CancellationToken cancellationToken) { Console.WriteLine("<< {0} {1}", (int) response.StatusCode, response.RequestMessage?.RequestUri); return response; } } - Wire logging (requires .NET ≥ 8 and HTTP 1.1)
NLog.Logger wireLogger = NLog.LogManager.GetLogger("wire"); // you can plug in any logging implementation, such as NLog or Microsoft.Extensions.Logging HttpClient http = new UnfuckedHttpClient(); http.Register(new WireLoggingFilter(new WireLoggingFilter.Config { LogRequestTransmitted = (message, id) => wireLogger.Trace("{0} >> {1}", id, message), LogResponseReceived = (message, id) => wireLogger.Trace("{0} << {1}", id, message), IsLogEnabled = () => wireLogger.IsTraceEnabled })); - Type-safe property registration
// request properties can be set on a shared HttpClient or ClientConfig http.Property(PropertyKey.JsonSerializerOptions, new JsonSerializerOptions()); // request properties can also be set on an immutable request target WebTarget target = http.Target("https://httpbin.org") .Property(PropertyKey.ThrowOnUnsuccessfulStatusCode, false); // request properties can be changed even if the HttpClient has already sent a request http.Property(PropertyKey.Timeout, TimeSpan.FromMinutes(1)) .Property(PropertyKey.AutomaticallyFollowRedirections, false); - Automatic response deserialization to given types from XML, JSON, and pluggable custom representations
// automatically mapped from JSON or XML depending on response content type and generic type, falling back to content sniffing response prefix without buffering the entire response into memory MyClass response = await http.Target(url).Get<MyClass>();HttpResponseMessage(or just don't pass a generic type parameter to the request method, likeGet()orPost())- Make sure to
Disposethis yourself
- Make sure to
Stream- Make sure to
Disposethis yourself
- Make sure to
ReadOnlyMemory<byte>Memory<byte>byte[]string- JSON (
System.Text.Json)JsonDocumentJsonNodeJsonObjectJsonArrayJsonValue- Any type that can be deserialized from JSON
- JSON (
Corvus.Text.Json)IJsonElement<T>, which is implemented by types that are automatically generated from a JSON Schema- This is a provided dependency, so it must be declared explicitly by dependents
- XML (
System.Xml)XmlDocumentXDocumentXPathNavigator- Any type that can be deserialized from XML
- HTML (
AngleSharpIDocument- This is a provided dependency, so it must be declared explicitly by dependents
IUtf8SpanParsableIParsable- Any type with a public constructor that takes a single
stringparameter - Any type
Twith a public staticT Parse(string)method - Any type
Twith a public staticbool TryParse(string, out T?)method - Any type you write a
MessageBodyReaderforusing var http = new UnfuckedHttpClient() .Register(new ZonedDateTimeReader()); public class ZonedDateTimeReader: MessageBodyReader { private static readonly ZonedDateTimePattern PARSER = ZonedDateTimePattern.CreateWithInvariantCulture("G", DateTimeZoneProviders.Tzdb); public bool CanRead<T>(MediaTypeHeaderValue? contentType) => typeof(T) == typeof(ZonedDateTime); public async Task<T> Read<T>(HttpResponseMessage res, Encoding? encoding, Configurable? cfg, CancellationToken ct) => PARSER.Parse(await res.Content.ReadAsStringAsync(ct)) switch { { Success: true, Value: var result } => (T) (object) result, { Success: false, Exception: var ex } => throw ex }; }
- To return both the automatically deserialized response body and the response itself so you can inspect the status code or headers, call the request method overloads that assign an
out Task<HttpResponseMessage>parameter.MyClass myClass = await target.Get<MyClass>(out Task<HttpResponseMessage> res); Console.WriteLine($"{(int) (await res).StatusCode}: {myClass}"); - Automatic request serialization from types to XML or JSON, the main benefit of which is to consistently apply serializer options, instead of always forgetting to expose and pass around a shared
JsonSerializerOptionsinstanceawait http.Target(url).Post(Entity.json(body)); - Disable chunked transfer encoding if the server is incompatible
using var http = new UnfuckedHttpClient { DefaultRequestHeaders = { TransferEncodingChunked = false } }; - Rich exception class hierarchy
try { string response = await http.Target(url).Get<string>(); } catch(NotFoundException) { // 404 } catch(NotAuthorizedException) { // 401 } catch(ServerErrorException) { // 5xx } catch(WebApplicationException) { // any unsuccessful status code } catch(ProcessingException) { } // network or deserialization error, like DNS, connection refused, timeout - Mockable and verifiable in unit or layer tests
All Unfucked libraries
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- System.Text.Json (>= 8.0.6)
- Unfucked (>= 0.0.1-beta.62)
- Unfucked.Caching (>= 0.0.1-beta.6)
-
net8.0
- Unfucked (>= 0.0.1-beta.62)
- Unfucked.Caching (>= 0.0.1-beta.6)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Unfucked.HTTP:
| Package | Downloads |
|---|---|
|
Gandi
Gandi LiveDNS API client that can create, read, update, and delete DNS records |
|
|
InoreaderCs
.NET client for the Inoreader HTTP API |
|
|
qBittorrentApiClient
Client for qBittorrent HTTP API |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1-beta.43 | 60 | 11/15/2026 |
| 0.0.1-beta.42 | 66 | 11/13/2026 |
| 0.0.1-beta.41 | 71 | 11/5/2026 |
| 0.0.1-beta.40 | 66 | 11/5/2026 |
| 0.0.1-beta.39 | 74 | 10/30/2026 |
| 0.0.1-beta.38 | 70 | 10/30/2026 |
| 0.0.1-beta.37 | 109 | 10/21/2026 |
| 0.0.1-beta.36 | 135 | 10/18/2026 |
| 0.0.1-beta.35 | 76 | 10/18/2026 |
| 0.0.1-beta.34 | 93 | 10/13/2026 |
| 0.0.1-beta.33 | 258 | 8/1/2026 |
| 0.0.1-beta.32 | 142 | 7/24/2026 |
| 0.0.1-beta.31 | 198 | 6/26/2026 |
| 0.0.1-beta.30 | 437 | 4/16/2026 |
| 0.0.1-beta.29 | 161 | 4/8/2026 |
| 0.0.1-beta.28 | 114 | 4/6/2026 |
| 0.0.1-beta.27 | 118 | 4/3/2026 |
| 0.0.1-beta.26 | 134 | 3/23/2026 |
| 0.0.1-beta.25 | 130 | 3/21/2026 |
| 0.0.1-beta.24 | 284 | 2/28/2026 |
Loading failed
