middleware

package
v27.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 14 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 deprecated

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

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

Deprecated: CORS headers should not be set on the API. This feature will be removed in the next release.

func NewCORSMiddleware deprecated

func NewCORSMiddleware(d string) CORSMiddleware

NewCORSMiddleware creates a new CORSMiddleware with default headers.

Deprecated: CORS headers should not be set on the API. This feature will be removed in the next release.

func (CORSMiddleware) WrapHandler

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 ExperimentalMiddleware

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

ExperimentalMiddleware is a the middleware in charge of adding the 'Docker-Experimental' header to every outgoing request

func NewExperimentalMiddleware

func NewExperimentalMiddleware(experimentalEnabled bool) ExperimentalMiddleware

NewExperimentalMiddleware creates a new ExperimentalMiddleware

func (ExperimentalMiddleware) WrapHandler

func (e ExperimentalMiddleware) 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 VersionMiddleware

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

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

func NewVersionMiddleware

func NewVersionMiddleware(serverVersion, defaultAPIVersion, minAPIVersion string) (*VersionMiddleware, error)

NewVersionMiddleware creates a VersionMiddleware with the given versions.

func (VersionMiddleware) WrapHandler

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