middleware

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2016 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"
	// CacheControlHeader sets the caches control header for the response
	CacheControlHeader = "Cache-Control"
	// PragmaHeader sets the pragma header for the response
	PragmaHeader = "Pragma"
	// ExpiresHeader sets the expires header for the response
	ExpiresHeader = "Expires"
	// CacheControl ensure no client-side caching
	CacheControl = "no-cache, no-store, must-revalidate"
	// Pragma ensure no client-side caching
	Pragma = "no-cache"
	// Expires ensure no client-side caching
	Expires = "0"
)

Variables

This section is empty.

Functions

func HTTPCachingHandler

func HTTPCachingHandler(dcdr client.IFace) func(*web.C, http.Handler) http.Handler

HTTPCachingHandle 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