Skip to content
/ httpx Public

A simple and convenient net/http wrapper with an Echo-like interface.

License

Notifications You must be signed in to change notification settings

tnychn/httpx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

httpx

Go Reference Tag License

A simple and convenient net/http wrapper with an Echo-like interface.


httpx wraps http.Request into httpx.Request and defines a httpx.Responder that implements http.ResponseWriter to provide handy functions to send variety of HTTP responses.

The library also provides an idiomatic way to handle errors inside HTTP handlers by defining a httpx.HandlerFunc (which implements http.Handler) that has a better signature than http.HandlerFunc.

Additionally, httpx.HandlerFunc is essentially a drop-in replacement for http.HandlerFunc. Most of the methods of httpx.Request and httpx.Responder are extracted from Echo's Context.

This is not a web framework, but rather an unopinionated library that extends net/http, as it does not include a HTTP router nor any mechanism that handles middlewares and the database layer.

In fact, you can leverage your favourite router e.g. gorilla/mux or chi to provide routing and middleware ability, and httpx works well with them.

In short, consider this library a lite version of Echo, but compatible with net/http, without any third party dependencies.

Why?

I want to use my favourite router along with some convenient methods from Echo's Context at the same time, but without other bloat and dependencies.

Roadmap

  • Request Data Binding
  • File Responder Methods
  • Real IP Extractor
  • Graceful Shutdown
  • Better TLS Support

Credits

Most of the code is adapted and modified from labstack/echo @v5_alpha, a high performance, minimalist web framework.