respmw

package
v0.0.0-...-9d84085 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoNothingResponseMiddleware

type DoNothingResponseMiddleware struct{}

DoNothingResponseMiddleware is an NO-OP implemenation of the ResponseMiddleware interface

func NewDoNothingResponseMiddleware

func NewDoNothingResponseMiddleware() *DoNothingResponseMiddleware

NewDoNothingResponseMiddleware returns a new DoNothingResponseMiddleware

func (*DoNothingResponseMiddleware) Do

Do does nothing to the given response

type MiddlewareNodeFn

type MiddlewareNodeFn func(
	resp *http.Response,
	next func(passed *http.Response) error,
) error

MiddlewareNodeFn represents the functionality of a single middleware in the chain. Each of these functions is responsible for invoking the next() middleware in the chain and handling the error.

type ResponseMiddleware

type ResponseMiddleware interface {
	Do(resp *http.Response) error
}

ResponseMiddleware represents the response-processing middleware functionality of a multiple-host proxy

type ResponseMiddlewareChain

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

ResponseMiddlewareChain represents a linked-list-like data structure where each node is a middleware to be executed

func NewResponseMiddlewareChain

func NewResponseMiddlewareChain(layers ...MiddlewareNodeFn) *ResponseMiddlewareChain

NewResponseMiddlewareChain returns a new ResponseMiddlewareChain initialized with the given list of MiddlewareNodeFn. They will be executed in the order in which they are given.

func (*ResponseMiddlewareChain) Do

Do executes the current MiddlewareNodeFn, with the next MiddlewareNodeFn as the next argument

Jump to

Keyboard shortcuts

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