[Redirect] How you should (not) use HttpClient

(The redirect tag in the title means this post is just a share of another post) So, how do you use the HttpClient (.NET)? Like this? 1 2 3 4 5 using (var client = new HttpClient()) { var result = await client.GetAsync("http://xpto.com/api/stuff"); //... } Well, so do I. And it’s wrong. Check out this article that tells you all about why. tl;dr Use a singleton instance. Oh, and after that one, this is also a good (important) related read....

October 27, 2016 · 1 min · 94 words · João Antunes