Documentation ¶
Overview ¶
middleware of the HTTP server The logger middleware adds logging support to every request
middleware of the HTTP server
middleware of the HTTP server The pre-flight middleware adds common response headers to requests
middleware of the HTTP server The recovery middleware attempts to recover from panics that occur within the request execution chain
middleware of the HTTP server Checks for and normalizes an API version for each request
Index ¶
Constants ¶
const ( AcceptHeaderPattern = "application/vnd.soulcycle.fed.v(\\d+(?:\\.\\d+)?)\\+json" VersionPattern = "\\d+\\.\\d+" )
const (
// String defining the format of the logger's date output
LogDateFormat = "01/02 - 15:04:05"
)
Variables ¶
var ( AcceptHeaderRegex *regexp.Regexp // Regex to check for valid Accept headers VersionRegex *regexp.Regexp // Regex to get version from Accept header )
var ( // Stream to write to for stdout // NOTE: Pattern used to allow for test-based overrides of stdout OutputStream *os.File = os.Stdout )
Functions ¶
func NewMiddleware ¶
NewMiddleware creates and returns a new instance of a middleware chain
Types ¶
type Logger ¶
Struct representing logger middleware
type Preflight ¶
type Preflight struct{}
Struct representing pre-flight middleware
func NewPreflight ¶
func NewPreflight() Preflight
NewPreflight creates and returns a new instance of pre-flight middleware
type Recovery ¶
type Recovery struct{}
Struct representing recovery middleware
func NewRecovery ¶
func NewRecovery() Recovery
NewRecovery creates and returns a new instance of recovery middleware
type Version ¶
type Version struct{}
Struct representing version middleware
func NewVersion ¶
func NewVersion() Version
NewVersion creates and returns a new instance of version middleware