header

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 1 Imported by: 4

Documentation

Index

Constants

View Source
const (
	AcceptEncoding                = "Accept-Encoding"
	AccessControlAllowCredentials = "Access-Control-Allow-Credentials"
	AccessControlAllowHeaders     = "Access-Control-Allow-Headers"
	AccessControlAllowMethods     = "Access-Control-Allow-Methods"
	AccessControlAllowOrigin      = "Access-Control-Allow-Origin"
	AccessControlExposeHeaders    = "Access-Control-Expose-Headers"
	AccessControlMaxAge           = "Access-Control-Max-Age"
	AccessControlRequestHeaders   = "Access-Control-Request-Headers"
	AccessControlRequestMethod    = "Access-Control-Request-Method"
	Authorization                 = "Authorization"
	ContentEncoding               = "Content-Encoding"
	ContentLength                 = "Content-Length"
	ContentType                   = "Content-Type"
	Origin                        = "Origin"
	RetryAfter                    = "Retry-After"
	SecWebsocketKey               = "Sec-Websocket-Key"
	StrictTransportSecurity       = "Strict-Transport-Security"
	Upgrade                       = "Upgrade"
	Vary                          = "Vary"
	WWWAuthenticate               = "Www-Authenticate"
	XForwardedFor                 = "X-Forwarded-For"
	XForwardedHost                = "X-Forwarded-Host"
	XForwardedMethod              = "X-Forwarded-Method"
	XForwardedProto               = "X-Forwarded-Proto"
	XForwardedURI                 = "X-Forwarded-Uri"
	XRealIP                       = "X-Real-Ip"
	XRequestID                    = "X-Request-Id"
)

Headers in canonical format

Variables

This section is empty.

Functions

func Add

func Add(h http.Header, key, value string)

func AddIfNotExists

func AddIfNotExists(h http.Header, key, value string)

func Del

func Del(h http.Header, key string)

func Exists

func Exists(h http.Header, key string) bool

func Get

func Get(h http.Header, key string) string

func Set

func Set(h http.Header, key, value string)

func SetShared added in v0.15.0

func SetShared(h http.Header, key string, vs []string)

SetShared assigns a pre-built value slice directly into the header map, sharing its backing array across every call instead of allocating a fresh []string{value} per request the way Set does.

Use it only for values fixed at construction time, and only on response headers: the shared slice must be treated as immutable. parapet's own middleware never mutate response header value slices in place — MapResponse rebuilds the slice, and only MapRequest mutates in place (request headers only) — so sharing is safe response-side. The cors middleware shares its precomputed header slices the same way.

Types

This section is empty.

Jump to

Keyboard shortcuts

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