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 TimeOrZero(ts *timestamppb.Timestamp) time.Time
- 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 the Cache-Control value for the JWKS documents, which change rarely and are always revalidated.
func TimeOrZero ¶ added in v1.125.0
func TimeOrZero(ts *timestamppb.Timestamp) time.Time
TimeOrZero returns the zero time for a nil Timestamp. AsTime on nil is the 1970 epoch, not "absent".
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.