.NET Blog

Professional .NET development tips and best practices

RestClient.Net 5

RestClient.Net 5

RestClient.Net makes HTTP calls in .NET easy. Send the request body as a strongly typed object, and get back a strongly typed object. You can inject the abstraction into your service classes and quickly mock them without worrying about the HTTP plumbing or converting to JSON. RestClient.Net 5 is a much improved, battle-hardened version that builds on the approach of V4 while introducing immutable types and a fluent API. It reduces the chance of shooting yourself in the foot with HttpClient, plays nicely with dependency injection, integrates with Polly, and the design should be familiar and comfortable to F# programmers. Why Use a Rest Client? The HttpClient and System.Uri classes are a mess, and yet we see them used throughout codebases. You shouldn’t use HttpClient directly, and you certainly shouldn’t new HttpClient in your code because this makes it impossible...
Christian Findlay Christian Findlay May 27, 2021