Documentation ¶
Index ¶
- Constants
- func DebugLoggingMiddleware(requestIDHeaderName string, fields logging.Fields) func(next http.Handler) http.Handler
- func ETag(cksum string) string
- func HeaderTimestamp(ts time.Time) string
- func HostMux(handlers ...*HostMuxHandler) http.Handler
- func HostOnly(hostname string) string
- func HostsOnly(hostname []string) []string
- func LoggingMiddleware(requestIDHeaderName string, fields logging.Fields) func(next http.Handler) http.Handler
- func RequestID(r *http.Request) (*http.Request, string)
- func RequestScheme(r *http.Request) string
- func ServeHealth() http.Handler
- func ServePPROF(pprofPrefix string) http.Handler
- func SetHealthHandlerInfo(info string)
- func TracingMiddleware(requestIDHeaderName string, fields logging.Fields) func(http.Handler) http.Handler
- type CappedBuffer
- type HostMuxHandler
- type MatchFn
- type MetricResponseWriter
- type ResponseRecordingWriter
Constants ¶
View Source
const ( MaxBodyBytes = 100 RequestTracingMaxRequestBodySize = 1024 * 1024 * 50 // 50KB RequestTracingMaxResponseBodySize = 1024 * 1024 * 150 // 150KB )
View Source
const (
// Last-Modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
DateHeaderTimestampFormat = "Mon, 02 Jan 2006 15:04:05 GMT"
)
View Source
const (
RequestIDContextKey contextKey = "request_id"
)
Variables ¶
This section is empty.
Functions ¶
func DebugLoggingMiddleware ¶
func HeaderTimestamp ¶
func HostMux ¶
func HostMux(handlers ...*HostMuxHandler) http.Handler
HostMux find the default handler
func LoggingMiddleware ¶
func RequestScheme ¶
func ServeHealth ¶
func ServePPROF ¶
func SetHealthHandlerInfo ¶
func SetHealthHandlerInfo(info string)
Types ¶
type CappedBuffer ¶
type HostMuxHandler ¶
type HostMuxHandler struct { MatchFns []MatchFn Handler http.Handler // contains filtered or unexported fields }
func HostHandler ¶
func HostHandler(handler http.Handler, hostPatterns ...MatchFn) *HostMuxHandler
func (*HostMuxHandler) Default ¶
func (h *HostMuxHandler) Default() *HostMuxHandler
type MatchFn ¶
func SubdomainsOf ¶
type MetricResponseWriter ¶
type MetricResponseWriter struct { http.ResponseWriter StatusCode int }
func NewMetricResponseWriter ¶
func NewMetricResponseWriter(w http.ResponseWriter) *MetricResponseWriter
func (*MetricResponseWriter) WriteHeader ¶
func (mrw *MetricResponseWriter) WriteHeader(code int)
type ResponseRecordingWriter ¶
type ResponseRecordingWriter struct { StatusCode int ResponseSize int64 Writer http.ResponseWriter }
func (*ResponseRecordingWriter) Header ¶
func (w *ResponseRecordingWriter) Header() http.Header
func (*ResponseRecordingWriter) Write ¶
func (w *ResponseRecordingWriter) Write(data []byte) (int, error)
func (*ResponseRecordingWriter) WriteHeader ¶
func (w *ResponseRecordingWriter) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.