storj/satellite/console/request.go
JT Olio 249f98f4c1 audit logging: log important user activity
Change-Id: Ic423dab4b6c513fa44a48cb6fe2903c70fe916fb
2020-09-07 15:26:34 +00:00

23 lines
502 B
Go

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
package console
import (
"context"
"net/http"
)
// WithRequest creates new context with *http.Request.
func WithRequest(ctx context.Context, req *http.Request) context.Context {
return context.WithValue(ctx, requestKey, req)
}
// GetRequest gets *http.Request from context.
func GetRequest(ctx context.Context) *http.Request {
if req, ok := ctx.Value(requestKey).(*http.Request); ok {
return req
}
return nil
}