Http BuildR Request is a simple set of C# functions for building requests using only System.Net.Http!
To use this library, simply include HttpBuildR.Request.dll
in your project or
grab
it from NuGet, and add
this to the top of each .cs
file that needs it:
using HttpBuildR;
using Req = HttpMethod;
Then get building!,
using HttpBuildR;
// its helpful to alias this for readability
using Req = HttpMethod;
...
HttpRequestMessage request =
// start with the Http method
Req.Post
// now we can say where the request is made to
// any thing that is a string or Uri will work
// plays nice with the flurl Url builder!
.To("http://some-url/some-part")
// add some headers
.WithBearerToken(token)
.WithAccept("application/json")
.WithHeader("x-custom-header", "a","b","c")
// with some content, they are all supported!
.WithJsonContent(new {Name = "John", Age = 36});
// now you can send it!!!
...
For more details/information have a look the test project or create an issue.