middleware

package
v0.0.0-...-72e02f8 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHeaderAlreadyCommitted = errors.New("response already committed")

Functions

func HybridPage

func HybridPage(cfg HybridPageConfig) echo.MiddlewareFunc

func PageSelector

func PageSelector(cfg PageSelectorConfig) echo.MiddlewareFunc

func PageSkipper

func PageSkipper(cfgRepository repository.Configuration) echo.MiddlewareFunc

func SiteSelector

func SiteSelector(cfg SiteSelectorConfig) echo.MiddlewareFunc

func SiteSkipper

func SiteSkipper(cfgRepository repository.Configuration) echo.MiddlewareFunc

Types

type HybridPageConfig

type HybridPageConfig struct {
	Skipper       middleware.Skipper
	PageHandler   pages.PageHandler
	CfgRepository repository.Configuration
}

type PageSelectorConfig

type PageSelectorConfig struct {
	Skipper        middleware.Skipper
	PageHandler    pages.PageHandler
	CfgRepository  repository.Configuration
	PageRepository repository.Page
}

type Response

type Response struct {
	Writer    http.ResponseWriter
	Buffer    *bytes.Buffer
	Status    int
	Size      int64
	Committed bool
}

func (*Response) Header

func (r *Response) Header() http.Header

Header returns the header map for the writer that will be sent by WriteHeader. Changing the header after a call to WriteHeader (or Write) has no effect unless the modified headers were declared as trailers by setting the "Trailer" header before the call to WriteHeader (see example) To suppress implicit response headers, set their value to nil. Example: https://golang.org/pkg/net/http/#example_ResponseWriter_trailers

func (*Response) Hijack

func (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error)

Hijack implements the http.Hijacker interface to allow an HTTP handler to take over the connection. See http.Hijacker(https://golang.org/pkg/net/http/#Hijacker)

func (*Response) Pusher

func (r *Response) Pusher() http.Pusher

Pusher implements the http.Pusher interface to allow an HTTP handler to constructs a synthetic request using the given target and options. See http.Pusher(https://golang.org/pkg/net/http/#Pusher)

func (*Response) Reset

func (r *Response) Reset(w http.ResponseWriter, b *bytes.Buffer)

func (*Response) StatusCode

func (r *Response) StatusCode() int

func (*Response) Unwrap

func (r *Response) Unwrap() http.ResponseWriter

Unwrap returns the original http.ResponseWriter. ResponseController can be used to access the original http.ResponseWriter. See [https://go.dev/blog/go1.20]

func (*Response) Write

func (r *Response) Write(b []byte) (n int, err error)

func (*Response) WriteHeader

func (r *Response) WriteHeader(status int)

type SiteSelectorConfig

type SiteSelectorConfig struct {
	Skipper       middleware.Skipper
	SiteSelector  pages.SiteSelector
	CfgRepository repository.Configuration
}

Jump to

Keyboard shortcuts

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