middleware

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 16 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 SessionMiddleware added in v0.0.9

func SessionMiddleware(cfg SessionConfig) echo.MiddlewareFunc

func SiteSelector

func SiteSelector(cfg SiteSelectorConfig) echo.MiddlewareFunc

Types

type HybridPageConfig

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

type PageSelectorConfig

type PageSelectorConfig struct {
	Skipper        middleware.Skipper
	PageHandler    cms.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 SessionConfig added in v0.0.9

type SessionConfig struct {
	Skipper         middleware.Skipper  `json:"-" yaml:"-"`
	Manager         *scs.SessionManager `json:"-" yaml:"-"`
	CleanupInterval time.Duration       `json:"cleanupInterval,omitempty" yaml:"cleanupInterval,omitempty"`
	IdleTimeout     time.Duration       `json:"idleTimeout,omitempty" yaml:"idleTimeout,omitempty"`
	Lifetime        time.Duration       `json:"lifetime,omitempty" yaml:"lifetime,omitempty"`
	Cookie          struct {
		Name     string             `json:"name,omitempty" yaml:"name,omitempty"`
		Domain   string             `json:"domain,omitempty" yaml:"domain,omitempty"`
		Path     string             `json:"path,omitempty" yaml:"path,omitempty"`
		Persist  bool               `json:"persist,omitempty" yaml:"persist,omitempty"`
		Secure   bool               `json:"secure,omitempty" yaml:"secure,omitempty"`
		HTTPOnly bool               `json:"httpOnly,omitempty" yaml:"httpOnly,omitempty"`
		SameSite echox.SameSiteType `json:"sameSite,omitempty" yaml:"sameSite,omitempty"`
	} `json:"cookie,omitempty" yaml:"cookie,omitempty"`
}

func (*SessionConfig) SetDefaults added in v0.0.9

func (cfg *SessionConfig) SetDefaults()

type SiteSelectorConfig

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

Jump to

Keyboard shortcuts

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