RestClient.Net is a cross-platform rest-client for .NET Core, .NET Framework, iOS, Android, WASM and UWP. It puts a wrapper over the .NET HttpClient API and allows you to write Rest client code that runs on any of the platforms. Version 4.0 of this library has been released, and I’d like to hear your feedback.
This is the Github release notes page that lists the issues the were fixed. The main problem with the previous version was that the client would attempt to deserialize responses that were non-successful. The library has been overhauled so that a useful exception is thrown instead.
Mocking has been made simpler by adding setters on all properties of requests and responses. This means that unit testing is more accessible.
Factories are now injected as delegates instead of interfaces. This is a breaking change This reduces boilerplate code. Check out this article about the approach.
All platforms now use System.Json.Text by default. This means that it is not necessary to create a serialization adapter unless you explicitly need to use Newtonsoft.
Using the Library
Check out the quick launch documentation and unit tests.
Why use RestClient.Net?
- It’s fast! Initial tests show that it is faster than RestSharp and is one of the faster .NET Rest Clients available.
- Designed for Dependency Injection, Unit Testing and use with IoC Containers
- Async friendly. All operations use async, await keywords.
- Integrates with Polly resilience and transient-fault-handling
- Automatic serialization with any method (JSON, Binary, SOAP, Google Protocol Buffers)
- Installation from NuGet is easy on any platform
- Uses strong types with content body
- Supports WebAssembly, Android, iOS, Windows 10, .NET Framework 4.5+, .NET Core (.NET Standard 2.0)
- Supports GET, POST, PUT, PATCH, DELETE with ability to use less common HTTP methods