chain

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: BSD-2-Clause Imports: 1 Imported by: 1

Documentation

Overview

Package chain provides types and functions to compose net/http compatible middlewares. It is completely borrowed from alice(https://godoc.org/github.com/justinas/alice)

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
}

Chain keeps a stack of net/http middlewares

func NewChain

func NewChain(m ...MiddlewareFn) Chain

NewChain is a constructor for a new chain

func (Chain) Append

func (c Chain) Append(m ...MiddlewareFn) Chain

Append takes a new http.Handler, appends and returns a new chain from the existing one. The given middleware chains are added to the end of request flow.

func (Chain) Extend

func (c Chain) Extend(chain Chain) Chain

Extend takes a new Chain, appends and returns a new chain from the existing one The given middleware chain is added to the end of request flow.

func (Chain) Then

func (c Chain) Then(fn http.Handler) http.Handler

Then terminates a middleware chain by passing the final http.Handler

type MiddlewareFn

type MiddlewareFn func(http.Handler) http.Handler

MiddlewareFn is a signature type for net/http middleware

Jump to

Keyboard shortcuts

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