utils

package
v1.111.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRequestBodyBytes = 16 << 10

Variables

This section is empty.

Functions

func AuthorizationScheme added in v1.93.0

func AuthorizationScheme(r *http.Request) (scheme, credentials string)

AuthorizationScheme returns the scheme and the trimmed credentials of the Authorization header. RFC 7235 allows more than one space between them.

func CacheDurationOrDefault added in v1.57.0

func CacheDurationOrDefault(d, fallback time.Duration) time.Duration

CacheDurationOrDefault returns d, or fallback if d is non-positive.

func ErrorLogFields added in v1.98.0

func ErrorLogFields(err error) logrus.Fields

ErrorLogFields returns the RFC 6749 fields of err for a log entry. An RFC6749Error's Error() is only its error code, so the hint and debug text reach the log only through these fields.

func GenerateRandomString

func GenerateRandomString(length int) (string, error)

func LimitRequestBody added in v1.60.2

func LimitRequestBody(w http.ResponseWriter, r *http.Request)

func StaticCacheControlValue added in v1.57.0

func StaticCacheControlValue(maxAge time.Duration) string

StaticCacheControlValue returns a Cache-Control value appropriate for a static, publicly cacheable document (JWKS, discovery metadata) that changes rarely enough to always require revalidation rather than a shorter max-age.

func ValidateRequestBody

func ValidateRequestBody(w http.ResponseWriter, r *http.Request) bool

func WriteJsonResponse

func WriteJsonResponse(w http.ResponseWriter, status int, data interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

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