Documentation
¶
Index ¶
- Constants
- func AuthorizationScheme(r *http.Request) (scheme, credentials string)
- func CacheDurationOrDefault(d, fallback time.Duration) time.Duration
- func ErrorLogFields(err error) logrus.Fields
- func GenerateRandomString(length int) (string, error)
- func LimitRequestBody(w http.ResponseWriter, r *http.Request)
- func StaticCacheControlValue(maxAge time.Duration) string
- func ValidateRequestBody(w http.ResponseWriter, r *http.Request) bool
- func WriteJsonResponse(w http.ResponseWriter, status int, data interface{})
Constants ¶
View Source
const MaxRequestBodyBytes = 16 << 10
Variables ¶
This section is empty.
Functions ¶
func AuthorizationScheme ¶ added in v1.93.0
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
CacheDurationOrDefault returns d, or fallback if d is non-positive.
func ErrorLogFields ¶ added in v1.98.0
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 LimitRequestBody ¶ added in v1.60.2
func LimitRequestBody(w http.ResponseWriter, r *http.Request)
func StaticCacheControlValue ¶ added in v1.57.0
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.
Click to show internal directories.
Click to hide internal directories.