middlewares

package
v1.0.0-beta.555 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CircuitBreaker

type CircuitBreaker struct {
	// contains filtered or unexported fields
}

CircuitBreaker holds the oxy circuit breaker.

func NewCircuitBreaker

func NewCircuitBreaker(next http.Handler, expression string, options ...cbreaker.CircuitBreakerOption) *CircuitBreaker

NewCircuitBreaker returns a new CircuitBreaker.

func (*CircuitBreaker) ServeHTTP

func (cb *CircuitBreaker) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

type HandlerSwitcher

type HandlerSwitcher struct {
	// contains filtered or unexported fields
}

HandlerSwitcher allows hot switching of http.ServeMux

func NewHandlerSwitcher

func NewHandlerSwitcher(newHandler *mux.Router) (hs *HandlerSwitcher)

NewHandlerSwitcher builds a new instance of HandlerSwitcher

func (*HandlerSwitcher) GetHandler

func (hs *HandlerSwitcher) GetHandler() (newHandler *mux.Router)

GetHandler returns the current http.ServeMux

func (*HandlerSwitcher) ServeHTTP

func (hs *HandlerSwitcher) ServeHTTP(rw http.ResponseWriter, r *http.Request)

func (*HandlerSwitcher) UpdateHandler

func (hs *HandlerSwitcher) UpdateHandler(newHandler *mux.Router)

UpdateHandler safely updates the current http.ServeMux with a new one

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is a middleware handler that logs the request as it goes in and the response as it goes out.

func NewLogger

func NewLogger(file string) *Logger

NewLogger returns a new Logger instance.

func (*Logger) Close

func (l *Logger) Close()

Close closes the logger (i.e. the file).

func (*Logger) ServeHTTP

func (l *Logger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

type Rewrite

type Rewrite struct {
	// contains filtered or unexported fields
}

Rewrite is a middleware that allows redirections

func NewRewrite

func NewRewrite(regex, replacement string, redirect bool) (*Rewrite, error)

NewRewrite creates a Rewrite middleware

func (*Rewrite) ServeHTTP

func (rewrite *Rewrite) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

type Routes

type Routes struct {
	// contains filtered or unexported fields
}

Routes holds the gorilla mux routes (for the API & co).

func NewRoutes

func NewRoutes(router *mux.Router) *Routes

NewRoutes return a Routes based on the given router.

func (*Routes) ServeHTTP

func (router *Routes) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

type StripPrefix

type StripPrefix struct {
	Handler  http.Handler
	Prefixes []string
}

StripPrefix is a middleware used to strip prefix from an URL request

func (*StripPrefix) ServeHTTP

func (s *StripPrefix) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*StripPrefix) SetHandler

func (s *StripPrefix) SetHandler(Handler http.Handler)

SetHandler sets handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL