Documentation
¶
Index ¶
- Constants
- func CORSMiddleware(next http.Handler) http.Handler
- func GetContentType(h http.Header, defaultType string) (string, map[string]string, error)
- func GetResponseMimeType(h http.Header, defaultType string, mimeTypes ...string) (string, error)
- func MetricsHandler(w http.ResponseWriter, _ *http.Request)
- func RequestLogger(h http.Handler) http.Handler
Constants ¶
View Source
const ( MimeTypeTextCharset = "text/plain; charset=utf-8" MimeTypeText = "text/plain" MimeTypeBytes = "application/octet-stream" MimeTypeAll = "*/*" HeaderNameAccept = "accept" HeaderNameContentType = "content-type" )
Variables ¶
This section is empty.
Functions ¶
func GetContentType ¶
GetContentType returns the content type and parameters from the header. If the content type is not set, the defaultType is returned.
func GetResponseMimeType ¶
GetResponseMimeType returns the response content type based on the Accept header. If the Accept header is not set, the defaultType is returned. If the Accept header is set, the response content type is negotiated based on the mimeTypes.
func MetricsHandler ¶ added in v1.14.6
func MetricsHandler(w http.ResponseWriter, _ *http.Request)
MetricsHandler is a HTTP handler that returns metrics from the ForNerds MetricsSet.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.