Versus Refit
Both libraries use the same idea: declare a REST API as a C# interface, generate the HttpClient implementation, and leave transport to the standard .NET HTTP stack. Refit is the mature, general-purpose client. HttpForge is a MauiEssentials-shaped subset for Android, iOS, Mac Catalyst, and Windows. It is not a drop-in Refit replacement.
| HttpForge | Refit | |
|---|---|---|
| Manual | RestService.For<T>(http) | RestService.For<T>(http) |
| DI | AddHttpForgeClient<T>(...) | AddRefitClient<T>() |
| MAUI host | UseHttpForge() | No MAUI-specific host API |
| Capability | HttpForge 1.0.1 | Refit 15 |
|---|---|---|
| Interface + [Get]/[Post]/[Put]/[Delete]/[Patch]/[Head] | Yes | Yes |
| Path, [AliasAs], [Query], [Body], [Header]/[Headers] | Yes | Yes |
| Multipart (StreamPart / ByteArrayPart / FileInfoPart) | Yes | Yes |
| CancellationToken | Yes | Yes |
| Task<IApiResponse<T>> | Yes | Yes |
| HTTP vs transport exceptions | ApiException / ApiRequestException | ApiException / ApiRequestException |
| Source-generated client and request construction | Yes | Yes (Refit 14+) |
| Compile-time diagnostics | HFG001–HFG006 | Yes (richer analyzer set) |
| System.Text.Json + JsonSerializerContext / AOT | Yes | Yes |
| IHttpClientFactory + DelegatingHandler | Yes | Yes (Refit.HttpClientFactory) |
| Query objects, collection formats, naming presets | No (v1) | Yes |
| [Timeout], [Url], [PathPrefix], optional segments | No (v1) | Yes |
| SSE / IAsyncEnumerable / JSON Lines | No (v1) | Yes |
| Authorization header value getter | No (v1) | Yes |
| Newtonsoft.Json / XML / reflection fallback | No | Yes (optional packages) |
| First-party stub testing package | No (v1) | Refit.Testing |
| Retry / cache / tokens / resume | Compose sibling plugins | Host-owned |
| Target matrix | net10.0 + Android / iOS / Mac Catalyst / Windows | Broader (.NET 8–11, WinUI, Blazor, Uno, .NET Framework) |
Mature general-purpose typed REST client. Refit on NuGet
Versus sibling HTTP plugins
| Need | Start with |
|---|---|
| Typed REST in a MauiEssentials app | Plugin.Maui.HttpForge |
| Already on Refit, or need Refit’s full surface | Refit |
| A few HttpClient calls | Hand-written HttpClient |
| Retry / circuit / offline POST queue | Plugin.Maui.ApiResilience |
| CacheFirst / SWR GET cache | Plugin.Maui.ApiCache |
| Tokens / 401 refresh | Plugin.Maui.SecureSession or ApiResilience |
| Resumable upload | Plugin.Maui.SmartUpload |
HttpForge keeps the declarative contract and source generation. It leaves mobile networking problems to sibling packages instead of embedding retry, cache, offline queue, or upload resume in the REST DSL.
When to choose HttpForge
- You want a Refit-style typed REST client that matches the MauiEssentials catalog.
- You need Android, iOS, Mac Catalyst, and Windows on net10.0.
- You want IHttpClientBuilder composition with ApiResilience, ApiCache, SecureSession, or SmartUpload.
- You prefer compile-time failure (HFG00x) over a reflection fallback.
Stay on Refit when the team already standardized on it, or when you need query objects, streaming, Newtonsoft/XML, or Refit.Testing. Use hand-written HttpClient for a handful of calls. Use sibling plugins when the question is retry, cache, tokens, or resume — not the REST contract.