middleware

package
v0.0.0-...-1388524 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package middleware contains middleware that can be added to request processing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware struct {
	// The processor run as part of the middlware.
	Processor Processor

	// Normally, middleware is not run after a prior middleware has generated a response.
	// The Always flag can be used to override this behaviour and always run a middleware.
	Always bool
}

A Middleware is a processor with some associated metadata.

func WithMiddlewares

func WithMiddlewares(responseFn Processor) []Middleware

WithMiddleware takes a Processor and adds pre- and postprocessing middleware to it.

type Processor

type Processor func(*request.Request) (request.Response, error)

A Processor takes a request and returns an optional Response. The processor may modify the request values.

Jump to

Keyboard shortcuts

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