Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultLoggingMiddleware(requestIDHeaderName string, fields logging.Fields, middlewareLogLevel string) func(next http.Handler) http.Handler
- func ETag(checksum string) string
- func GetRequestLakeFSClient(r *http.Request) string
- func HeaderTimestamp(ts time.Time) string
- func HostMatches(r *http.Request, hosts []string) bool
- func HostOnly(hostname string) string
- func HostSubdomainOf(r *http.Request, hosts []string) bool
- func HostsOnly(hostname []string) []string
- func IsRequestCanceled(r *http.Request) bool
- func IsSuccessStatusCode(response *http.Response) bool
- 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 SourceIP(r *http.Request) string
- func StripQuotesAndSpaces(etag string) string
- func TracingMiddleware(requestIDHeaderName string, fields logging.Fields, traceRequestHeaders bool) func(http.Handler) http.Handler
- type CappedBuffer
- type MetricResponseWriter
- type Range
- type ResponseRecordingWriter
Constants ¶
View Source
const ( RequestIDContextKey contextKey = "request_id" AuditLogEndMessage string = "HTTP call ended" )
View Source
const ( MaxBodyBytes = 750 // Log lines will be < 2KiB RequestTracingMaxRequestBodySize = 1024 * 1024 * 50 // 50KB RequestTracingMaxResponseBodySize = 1024 * 1024 * 150 // 150KB )
View Source
const (
// DateHeaderTimestampFormat - Last-Modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
DateHeaderTimestampFormat = "Mon, 02 Jan 2006 15:04:05 GMT"
)
View Source
const (
RequestIDHeaderName = "X-Request-ID"
)
Variables ¶
View Source
var ErrBadRange = errors.New("invalid range")
View Source
var ErrUnsatisfiableRange = errors.New("unsatisfiable range")
Functions ¶
func DefaultLoggingMiddleware ¶ added in v0.68.0
func GetRequestLakeFSClient ¶ added in v0.83.0
GetRequestLakeFSClient get lakeFS client identifier from request.
It extracts the data from X-Lakefs-Client header and fallback to the user-agent
func HeaderTimestamp ¶
func IsRequestCanceled ¶ added in v0.88.0
func IsSuccessStatusCode ¶ added in v0.113.0
IsSuccessStatusCode returns true for status code 2xx
func LoggingMiddleware ¶
func RequestScheme ¶
func ServeHealth ¶
func ServePPROF ¶
func SetHealthHandlerInfo ¶
func SetHealthHandlerInfo(info string)
func StripQuotesAndSpaces ¶ added in v1.7.0
Types ¶
type CappedBuffer ¶
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 Range ¶ added in v0.86.0
Range represents an RFC 2616 HTTP Range
func ParseRange ¶ added in v0.86.0
ParseRange parses an HTTP RFC 2616 Range header value and returns an Range object for the given object length
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.