Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.28 KB

File metadata and controls

48 lines (34 loc) · 1.28 KB

HTTP BuildR Response HTTP BuildR Response

Nuget

Http 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.

Getting Started

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.