middleware

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IfNoneMatchHeader http header containing the clients CurrentSHA
	IfNoneMatchHeader = "If-None-Match"
	// EtagHeader header used to pass the CurrentSHA in responses
	EtagHeader = "Etag"
	// LastModified date when the feature set was last updated
	LastModifiedHeader = "Last-Modified"
	// CacheControlHeader sets the caches control header for the response
	CacheControlHeader = "Cache-Control"
	// CacheControl ensure no client-side or proxy caching
	CacheControl = "private, max-age=0, no-cache, no-store, must-revalidate, proxy-revalidate"
	// PragmaHeader sets the pragma header for the response
	PragmaHeader = "Pragma"
	// Pragma ensure no client-side caching
	Pragma = "no-cache"
	// ExpiresHeader sets the expires header for the response
	ExpiresHeader = "Expires"
	// Expires ensure no client-side caching
	Expires = "0"
)

Variables

This section is empty.

Functions

func HTTPCachingHandler

func HTTPCachingHandler(dcdr client.IFace) func(http.Handler) http.Handler

HTTPCachingHandler middleware that provides HTTP level caching using the If-None-Match header. If the value of this header contains a matching CurrentSHA this handler will write a 304 status and return.

func NotModified

func NotModified(sha string, r *http.Request) bool

NotModified checks the requests If-None-Match header for a matching CurrentSHA in the Client.

func SetCacheHeaders

func SetCacheHeaders(w http.ResponseWriter, r *http.Request)

SetCacheHeaders ensure response is not cached on the client. Caching should be done using the Etag and If-None-Match headers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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