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.1.0 | Refit 15 |
|---|---|---|
| Interface + [Get]/[Post]/[Put]/[Delete]/[Patch]/[Head] | Yes | Yes |
| Path, [AliasAs], [Query], [Body], [Header]/[Headers] | Yes | Yes |
| Query objects, collection formats, camel/snake/kebab | Yes | Yes |
| [Timeout], [Url], [PathPrefix], optional {id?} | Yes | Yes |
| [QueryName] valueless flags, [FormObject] | Yes | Yes |
| Multipart (StreamPart / ByteArrayPart / FileInfoPart) | Yes | Yes |
| CancellationToken | Yes | Yes |
| Task<IApiResponse<T>> | Yes | Yes |
| SSE / IAsyncEnumerable / JSON Lines | Yes | Yes |
| Request-body compression | gzip / brotli | Yes (15.2+) |
| Authorization header value getter | Yes (attach only; absolute URI) | Yes |
| HTTP vs transport exceptions | ApiException / ApiRequestException | ApiException / ApiRequestException |
| Source-generated client and request construction | Yes | Yes (Refit 14+) |
| Compile-time diagnostics | HFG001–HFG010 | Yes (richer analyzer set) |
| System.Text.Json + JsonSerializerContext / AOT | Yes | Yes |
| IHttpClientFactory + DelegatingHandler | Yes | Yes (Refit.HttpClientFactory) |
| Newtonsoft.Json / XML | Optional packages | Refit.Newtonsoft.Json / Refit.Xml |
| First-party stub testing package | Plugin.Maui.HttpForge.Testing | Refit.Testing |
| Reflection fallback | No (generated-only) | Refit.Reflection |
| 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) |
| Need | HttpForge | Refit |
|---|---|---|
| Core generated client | Plugin.Maui.HttpForge | Refit |
| DI / IHttpClientFactory | Included | Refit.HttpClientFactory |
| Newtonsoft.Json | Plugin.Maui.HttpForge.NewtonsoftJson | Refit.Newtonsoft.Json |
| XML (XXE-safe) | Plugin.Maui.HttpForge.Xml | Refit.Xml |
| Test stubs | Plugin.Maui.HttpForge.Testing | Refit.Testing |
| Reflection fallback | Not planned | Refit.Reflection |
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 (HFG001–HFG010) over a reflection fallback.
Stay on Refit when the team already standardized on it, needs a reflection fallback, or targets a broader framework matrix. 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.