middleware

package
v0.0.0-...-f198145 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecorateResponse

type DecorateResponse struct{}

func (DecorateResponse) Handle

func (r DecorateResponse) Handle(request inter.Request, next inter.Next) inter.Response

type DefaultResponseOutcome

type DefaultResponseOutcome struct {
	Outcome func(content interface{}) inter.Response
}

func (DefaultResponseOutcome) Handle

func (r DefaultResponseOutcome) Handle(request inter.Request, next inter.Next) inter.Response

type PanicToResponse

type PanicToResponse struct{}

func (PanicToResponse) Handle

func (p PanicToResponse) Handle(request inter.Request, next inter.Next) (response inter.Response)

Change an error from a temporary response to a complete response

type Pipe

type Pipe interface {
	Handle(request inter.Request, next inter.Next) inter.Response
}

type Pipeline

type Pipeline struct {
	App inter.App

	// The object being passed through the contract.
	Passable inter.Request

	// the array of pipes.
	Pipes []inter.HttpMiddleware
}

noinspection GoNameStartsWithPackageName

func NewPipeline

func NewPipeline(app inter.App) Pipeline

func (Pipeline) AppPath

func (p Pipeline) AppPath() string

func (Pipeline) Send

func (p Pipeline) Send(passable inter.Request) Pipeline

Set the object being sent through the contract.

func (Pipeline) Then

func (p Pipeline) Then(controller inter.Controller) inter.Response

Run the contract with a final destination pipe holder. In this case, pipes are middlewares with a request and a response

func (Pipeline) Through

func (p Pipeline) Through(pipes []inter.HttpMiddleware) Pipeline

Set the array of pipes.

type RequestBodyDecoder

type RequestBodyDecoder struct{}

func (RequestBodyDecoder) Handle

func (r RequestBodyDecoder) Handle(request inter.Request, next inter.Next) inter.Response

This ensures the request can be decoded from JSON and Multipart Form. Feel free to add your own decoders to support other formats as well.

type RequestID

type RequestID struct{}

func (RequestID) Handle

func (_ RequestID) Handle(request inter.Request, next inter.Next) inter.Response

Jump to

Keyboard shortcuts

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