Skip to content

v0.1.2: Middlewares

Compare
Choose a tag to compare
@hawry hawry released this 07 Jan 22:27
· 17 commits to master since this release

Middlewares

Package middlewares aims to create a set of commonly used middleware http.Handlers for use with the default http package. All handlers only takes a http.Handler as an argument, and returns only http.Handler, to more easily be chained with handler chain libraries (e.g. https://github.com/justinas/alice)

Handlers

  • CORS Handler that appends CORS headers depending on the request, and your settings
  • Token handler that extracts any bearer token from a request, if found
  • Basic authorization handler that extracts username and password from a request that contains a Basic authorization header
  • Logging handler that writes a log in Apache Combined Logging format to the output of your choosing (see documentation for an example of how to log both to console and file at the same time)

Documentation

Can be found at GoDoc: https://godoc.org/github.com/Hawry/middlewares