middleware

package
v0.0.0-...-27cb6b7 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomWriter

type CustomWriter struct {
	Buf     *bytes.Buffer
	Rw      http.ResponseWriter
	Req     *http.Request
	Headers http.Header
	// contains filtered or unexported fields
}

CustomWriter handles the response and provide the way to cache the value

func NewCustomWriter

func NewCustomWriter(rq *http.Request, rw http.ResponseWriter, b *bytes.Buffer) *CustomWriter

func (*CustomWriter) Header

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

Header will write the response headers

func (*CustomWriter) Send

func (r *CustomWriter) Send() (int, error)

Send delays the response to handle Cache-Status

func (*CustomWriter) Write

func (r *CustomWriter) Write(b []byte) (int, error)

Write will write the response body

func (*CustomWriter) WriteHeader

func (r *CustomWriter) WriteHeader(code int)

WriteHeader will write the response headers

type SouinBaseHandler

type SouinBaseHandler struct {
	Configuration            configurationtypes.AbstractConfigurationInterface
	Storers                  []types.Storer
	InternalEndpointHandlers *api.MapHandler
	ExcludeRegex             *regexp.Regexp
	RegexpUrls               regexp.Regexp
	SurrogateKeys            configurationtypes.SurrogateKeys
	SurrogateKeyStorer       providers.SurrogateInterface
	DefaultMatchedUrl        configurationtypes.URL
	// contains filtered or unexported fields
}

func (*SouinBaseHandler) HandleInternally

func (s *SouinBaseHandler) HandleInternally(r *http.Request) (bool, http.HandlerFunc)

func (*SouinBaseHandler) Revalidate

func (s *SouinBaseHandler) Revalidate(validator *rfc.Revalidator, next handlerFunc, customWriter *CustomWriter, rq *http.Request, requestCc *cacheobject.RequestCacheDirectives, cachedKey string) error

func (*SouinBaseHandler) ServeHTTP

func (s *SouinBaseHandler) ServeHTTP(rw http.ResponseWriter, rq *http.Request, next handlerFunc) error

func (*SouinBaseHandler) Store

func (s *SouinBaseHandler) Store(
	customWriter *CustomWriter,
	rq *http.Request,
	requestCc *cacheobject.RequestCacheDirectives,
	cachedKey string,
) error

func (*SouinBaseHandler) Upstream

func (s *SouinBaseHandler) Upstream(
	customWriter *CustomWriter,
	rq *http.Request,
	next handlerFunc,
	requestCc *cacheobject.RequestCacheDirectives,
	cachedKey string,
) error

type SouinWriterInterface

type SouinWriterInterface interface {
	http.ResponseWriter
	Send() (int, error)
}

Jump to

Keyboard shortcuts

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