Skip to content

About

Simple C# functions for building 🔨 requests and responses using only the core System.Net.Http!

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

10 stars

Watchers

1 watching

Forks

Latest commit

 

History

343 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Http BuildR

Http BuildR

Requests and responses, standard library only.

A fluent builder for HttpRequestMessage and HttpResponseMessage built on System.Net.Http alone, with no dependencies and no wrapper types.

Nuget Coverage Quality Gate Status CD Build Check Markdown

🏃 Getting Started | 📚 Documentation

What it does

The builders are extension methods on the types in System.Net.Http, so a request or response stays a plain HttpRequestMessage or HttpResponseMessage.

  • No dependencies beyond System.Net.Http
  • No wrapper types
  • Headers, content and version set in one chain
using HttpBuildR;

// alias the method so the chain reads like a sentence
using Req = HttpMethod;

HttpRequestMessage request =
    Req.Post
        .To("http://some-url/some-part")
        .WithBearerToken(token)
        .WithAccept("application/json")
        .WithHeader("x-custom-header", "a", "b", "c")
        .WithJsonContent(new { Name = "John", Age = 36 });

The chain builds a request. Sending it is still up to the caller.

Packages

Package Builds NuGet
HttpBuildR.Request HttpRequestMessage nuget
HttpBuildR.Response HttpResponseMessage nuget
HttpBuildR.ActionResult HttpResponseMessage from an action result nuget

Documentation

The test projects in src/Request/HttpBuildR.Request.Tests and src/Response/HttpBuildR.Response.Tests cover every builder, and are the closest thing to a reference for edge cases.

Why another one?

Most http libraries wrap System.Net.Http in a client of their own. This one keeps the core types and only replaces the setup code with a chain, so anything that already accepts an HttpRequestMessage keeps working.

Attributions

Construction icons created by juicy_fish

About

Simple C# functions for building 🔨 requests and responses using only the core System.Net.Http!

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages