middleware

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package middleware provides middleware for http Handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

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

A Chain is a middleware chain use for http request processing.

func NewChain

func NewChain(middlewares ...MiddlewareFunc) Chain

NewChain creates a new Middleware chain

func (Chain) Chain

func (c Chain) Chain(handler http.Handler) http.Handler

Chain returns a http.Handler that chains the middleware onion-style around the handler.

type MiddlewareFunc

type MiddlewareFunc func(next http.Handler) http.Handler

MiddlewareFunc is a function that acts as middleware for http Handlers.

func Conditional

func Conditional(middleware MiddlewareFunc, condition func(r *http.Request) bool) MiddlewareFunc

Conditional is a middleware that only executes middleware if the condition returns true for the request. If the condition returns false, the middleware is skipped, and request handling moves on to the next handler in the chain.

Directories

Path Synopsis
Package cors does cors stuff
Package cors does cors stuff
Package echocontext adds the echo context to the parent context
Package echocontext adds the echo context to the parent context
Package mime does mime stuff
Package mime does mime stuff
Package redirect does redirect stuff
Package redirect does redirect stuff

Jump to

Keyboard shortcuts

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