middleware

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugRequestMiddleware

func DebugRequestMiddleware(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error

DebugRequestMiddleware dumps the request to logger

Types

type CORSMiddleware added in v1.12.0

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

CORSMiddleware injects CORS headers to each request when it's configured.

func NewCORSMiddleware

func NewCORSMiddleware(d string) CORSMiddleware

NewCORSMiddleware creates a new CORSMiddleware with default headers.

func (CORSMiddleware) WrapHandler added in v1.12.0

func (c CORSMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error

WrapHandler returns a new handler function wrapping the previous one in the request chain.

type Middleware

type Middleware interface {
	WrapHandler(func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error
}

Middleware is an interface to allow the use of ordinary functions as Docker API filters. Any struct that has the appropriate signature can be registered as a middleware.

type UserAgentMiddleware added in v1.12.0

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

UserAgentMiddleware is a middleware that validates the client user-agent.

func NewUserAgentMiddleware

func NewUserAgentMiddleware(s string) UserAgentMiddleware

NewUserAgentMiddleware creates a new UserAgentMiddleware with the server version.

func (UserAgentMiddleware) WrapHandler added in v1.12.0

func (u UserAgentMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error

WrapHandler returns a new handler function wrapping the previous one in the request chain.

type VersionMiddleware added in v1.12.0

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

VersionMiddleware is a middleware that validates the client and server versions.

func NewVersionMiddleware

func NewVersionMiddleware(s, d, m string) VersionMiddleware

NewVersionMiddleware creates a new VersionMiddleware with the default versions.

func (VersionMiddleware) WrapHandler added in v1.12.0

func (v VersionMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error

WrapHandler returns a new handler function wrapping the previous one in the request chain.

Jump to

Keyboard shortcuts

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