Updating server dependancies (#5249)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
ca3211bc04
Коммит
701d1ab638
7
vendor/github.com/prometheus/common/route/route.go
сгенерированный
поставляемый
7
vendor/github.com/prometheus/common/route/route.go
сгенерированный
поставляемый
@@ -33,18 +33,19 @@ func WithParam(ctx context.Context, p, v string) context.Context {
|
||||
return context.WithValue(ctx, param(p), v)
|
||||
}
|
||||
|
||||
type contextFn func(r *http.Request) (context.Context, error)
|
||||
// ContextFunc returns a new context for a request.
|
||||
type ContextFunc func(r *http.Request) (context.Context, error)
|
||||
|
||||
// Router wraps httprouter.Router and adds support for prefixed sub-routers
|
||||
// and per-request context injections.
|
||||
type Router struct {
|
||||
rtr *httprouter.Router
|
||||
prefix string
|
||||
ctxFn contextFn
|
||||
ctxFn ContextFunc
|
||||
}
|
||||
|
||||
// New returns a new Router.
|
||||
func New(ctxFn contextFn) *Router {
|
||||
func New(ctxFn ContextFunc) *Router {
|
||||
if ctxFn == nil {
|
||||
ctxFn = func(r *http.Request) (context.Context, error) {
|
||||
return context.Background(), nil
|
||||
|
||||
2
vendor/github.com/prometheus/common/route/route_test.go
сгенерированный
поставляемый
2
vendor/github.com/prometheus/common/route/route_test.go
сгенерированный
поставляемый
@@ -29,7 +29,7 @@ func TestRedirect(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestContextFn(t *testing.T) {
|
||||
func TestContextFunc(t *testing.T) {
|
||||
router := New(func(r *http.Request) (context.Context, error) {
|
||||
return context.WithValue(context.Background(), "testkey", "testvalue"), nil
|
||||
})
|
||||
|
||||
Ссылка в новой задаче
Block a user