headers

package
v8.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentDispositionHeader = "Content-Disposition"
	ContentTypeHeader        = "Content-Type"

	// Workhorse related headers
	GitlabWorkhorseSendDataHeader = "Gitlab-Workhorse-Send-Data"
	XSendFileHeader               = "X-Sendfile"
	XSendFileTypeHeader           = "X-Sendfile-Type"

	// Signal header that indicates Workhorse should detect and set the content headers
	GitlabWorkhorseDetectContentTypeHeader = "Gitlab-Workhorse-Detect-Content-Type"
)

HTTP Headers

View Source
const MaxDetectSize = 512

Max number of bytes that http.DetectContentType needs to get the content type

Variables

View Source
var (
	ImageTypeRegex   = regexp.MustCompile(`^image/*`)
	SvgMimeTypeRegex = regexp.MustCompile(`^image/svg\+xml$`)

	TextTypeRegex = regexp.MustCompile(`^text/*`)

	VideoTypeRegex = regexp.MustCompile(`^video/*`)

	AttachmentRegex = regexp.MustCompile(`^attachment`)
)

Functions

func AnyResponseHeaderPresent

func AnyResponseHeaderPresent(rw http.ResponseWriter) bool

AnyResponseHeaderPresent checks in the ResponseWriter if there is any Response Header

func IsDetectContentTypeHeaderPresent

func IsDetectContentTypeHeaderPresent(rw http.ResponseWriter) bool

func RemoveResponseHeaders

func RemoveResponseHeaders(rw http.ResponseWriter)

RemoveResponseHeaders removes any ResponseHeader from the ResponseWriter

func SafeContentHeaders

func SafeContentHeaders(data []byte, contentDisposition string) (string, string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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