header

package
v1.65.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0, MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package header can be used to sanitize HTTP request and response headers.

Index

Constants

This section is empty.

Variables

View Source
var DefaultSanitizers = map[string]SanitizeHeaderFunc{
	"Authorization":       AuthorizationSanitizer,
	"Set-Cookie":          SetCookieSanitizer,
	"Cookie":              CookieSanitizer,
	"Proxy-Authorization": AuthorizationSanitizer,
}

DefaultSanitizers contains a list of sanitizers to be used for common headers.

Functions

func AuthorizationSanitizer

func AuthorizationSanitizer(unsafe string) string

AuthorizationSanitizer is used to sanitize Authorization and Proxy-Authorization headers.

func CookieSanitizer

func CookieSanitizer(unsafe string) string

CookieSanitizer is used to sanitize Cookie header.

func Sanitize

func Sanitize(sanitizers map[string]SanitizeHeaderFunc, headers http.Header) http.Header

Sanitize list of headers. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ can be consulted for header syntax.

func SetCookieSanitizer

func SetCookieSanitizer(unsafe string) string

SetCookieSanitizer is used to sanitize Set-Cookie header.

Types

type SanitizeHeaderFunc

type SanitizeHeaderFunc func(string) string

SanitizeHeaderFunc implements sanitization for a header value.

Jump to

Keyboard shortcuts

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