Utility functions that can compose http.Handlers and http.HandlerFuncs to create middlewares. Note that when the status code is written to the http.ResponseWriter, the response is immediately flushed regardless whether a handlers further down the middleware chain is writing to the http.ResponseWriter.
Some use cases where this may be useful are listed below. Please feel free to comment to add to the list.
- Requiring authentication before allowing access to the main handler
- Proxy to different services depending on application logic or migrations