Testing code that uses HttpWebRequest directly, is a real pain. Usually what I have seen people do is create a service interface that hides the real http client behind the interface and then create fake service implementations to actually run their tests against. The annoying part about that solution is that Http client interfaces tend [...]
Posts tagged HTTPClient
HttpContent instead of streams
I think the HttpContent class is my favourite part of this library. This class acts as a container for the content that you received or are about to send.
Handling returned content
When you do make an http request with this library, the body of the response is wrapped inside an HttpContent object. So, when you [...]
HttpClient – The basics
Before I go into any details I thought it would be valuable to give some basic examples of how to use the HTTPClient.
Retrieve some HTTP content from an URL
var client = new HttpClient();
var response = client.Get("http://example.org");
Post some content to an Url
var client = new HttpClient();
var content = HttpContent.Create("This is some string content");
var response = client.Post("http://example.com", [...]
Why the Microsoft.Http library is awesome.
In various forums I a finding myself raving about this new library. I decided that I should write some blog posts on the subject for a few reasons. 1) to convince myself that there is actually some substance to my raving; 2) provide a place to point people to in order to substantiate my infatuation [...]
WCF REST Starter Kit Preview 2
I have been looking thought the latest release of the WCF REST Starter Kit and there are some interesting things there. Especially the new HttpClient class in the Microsoft.Http namespace. I will not talk about the server side of things because I really don’t have anything nice to say and until I have some constructive [...]
Posts