http

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CacheControlMustRevalidate that the response can be stored in caches and can be reused while fresh.
	CacheControlMustRevalidate = "must-revalidate"
	// CacheControlNoCache indicates the response must be validated with the origin server before each reuse.
	CacheControlNoCache = "no-cache"
	// CacheControlNoStore indicates that all caches should not store this response.
	CacheControlNoStore = "no-store"
	// CacheControlNoTransform indicates that any intermediary shouldn't transform the response contents.
	CacheControlNoTransform = "no-transform"

	// HeaderAccept is the key for the accept header.
	HeaderAccept = "Accept"
	// HeaderCacheControl is the key for the cache control header.
	HeaderCacheControl = "Cache-Control"
	// HeaderContentType is the key for the content type header.
	HeaderContentType = "Content-Type"
)
View Source
const (
	// MimeAll matches any mime type.
	MimeAll Mime = `*/*`

	// MimeAppJRDJSON represents a JSON Resource Descriptor type.
	MimeAppJRDJSON Mime = `application/jrd+json`
	// MimeAppJSON represents a JavaScript Object Notation type.
	MimeAppJSON Mime = `application/json`
	// MimeAppActivityJSON represents a JSON activity pub action type.
	MimeAppActivityJSON Mime = `application/activity+json`
	// MimeAppActivityLDJSON represents JSON-based Linked Data for activity streams type.
	MimeAppActivityLDJSON Mime = `application/ld+json; profile="https://www.w3.org/ns/activitystreams"`
	// MimeAppXML represents an Extensible Markup Language type.
	MimeAppXML Mime = `application/xml`
	// MimeImageGIF represents a gif image type.
	MimeImageGIF Mime = `image/gif`
	// MimeImageJPG represents a jpg image type.
	MimeImageJPG Mime = `image/jpeg`
	// MimeImagePNG represents a png image type.
	MimeImagePNG Mime = `image/png`
	// MimeImageSVG represents a svg image type.
	MimeImageSVG Mime = `image/svg+xml`
	// MimeImageWebP represents a webp image type.
	MimeImageWebP Mime = `image/webp`
	// MimeTextCSV represents a csv type.
	MimeTextCSV Mime = `text/csv`
	// MimeTextHTML represents a html type.
	MimeTextHTML Mime = `text/html`
	// MimeTextPlain represents a plain text type.
	MimeTextPlain Mime = `text/plain`

	// SuffixAppJSON represents a JavaScript Object Notation suffix.
	SuffixAppJSON Suffix = `json`
	// SuffixAppXML represents an Extensible Markup Language suffix.
	SuffixAppXML Suffix = `xml`
	// SuffixImageGIF represents a gif image suffix.
	SuffixImageGIF Suffix = `gif`
	// SuffixImageJPG represents a jpg image suffix.
	SuffixImageJPG Suffix = `jpg`
	// SuffixImagePNG represents a png image suffix.
	SuffixImagePNG Suffix = `png`
	// SuffixImageSVG represents a svg image suffix.
	SuffixImageSVG Suffix = `svg`
	// SuffixImageWebP represents a webp image suffix.
	SuffixImageWebP Suffix = `webp`
	// SuffixTextCSV represents a csv suffix.
	SuffixTextCSV Suffix = `csv`
	// SuffixTextHTML represents a html suffix.
	SuffixTextHTML Suffix = `html`
	// SuffixTextPlain represents a plain text suffix.
	SuffixTextPlain Suffix = `txt`
)

Variables

This section is empty.

Functions

func BlockFloc

func BlockFloc(next http.Handler) http.Handler

BlockFloc is a middleware that applies a header to tell Google Chrome to disable cohort tracking.

func BlockMissingUserAgent

func BlockMissingUserAgent(next http.Handler) http.Handler

BlockMissingUserAgent is a middleware that returns 400 Bad Request if the useragent is missing.

func GetPageLang

func GetPageLang(query, header, defaultLang string) string

func GetPaginationFromURL

func GetPaginationFromURL(u *url.URL, defaultCount int) (page int, count int, countFound bool)

GetPaginationFromURL returns a page and item count derived from the url query returns true if count is present in query.

Types

type Mime

type Mime string

func ToMime

func ToMime(s Suffix) Mime

func (Mime) String

func (m Mime) String() string

type Suffix

type Suffix string

func ToSuffix

func ToSuffix(m Mime) Suffix

func (Suffix) String

func (s Suffix) String() string

Jump to

Keyboard shortcuts

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