Simple response builder functions on top of System.Net.Http!
$ dotnet add package HttpBuildR.ResponseHttp BuildR Response is a simple set of C# functions for building responses using only System.Net.Http!
Can be used on the testing side for building expected responses.
To use this library, simply include HttpBuildR.Response.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 Resp = HttpStatusCode;
Then get building!,
using HttpBuildR;
// its helpful to alias this for readability
using Resp = HttpStatusCode;
...
HttpRequestMessage request =
// start with a Http status code
Resp.OK
.Result()
// add some headers
.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 back!!!
...
For more details/information have a look the test project or create an issue.