utils

package
v1.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HandlerTypeCustom Set this value in any custom handler bypassing grpc-middleware.
	// This makes sure that any value passed in the context is processed by UAM middlewares
	HandlerTypeCustom  = "custom-handler"
	HeaderKeyRequestID = "x-request-id"
	HeaderKeyAuditID   = "x-nv-audit-id"
	HeaderETag         = "etag"
	HeaderNewETag      = "new-etag"
	HeaderIfMatch      = "if-match"
)
View Source
const HeaderNVPrefix = "nvkit-"

Variables

Functions

func AddRequestInfoToContext

func AddRequestInfoToContext(req *http.Request) *http.Request

AddRequestInfoToContext adds any custom values from request headers to request context that helps nvkit middleware

func ContextWithCustomHandlerForTest added in v1.0.15

func ContextWithCustomHandlerForTest(ctx context.Context, requestID string) context.Context

ContextWithCustomHandlerForTest enriches ctx the way AddRequestInfoToContext does for custom-handler paths; for tests outside this package.

func ContextWithCustomHandlerMarkerForTest added in v1.0.15

func ContextWithCustomHandlerMarkerForTest(ctx context.Context) context.Context

ContextWithCustomHandlerMarkerForTest sets only the custom-handler marker (no request ID key), for tests outside this package.

func CustomHandlerContext added in v1.0.15

func CustomHandlerContext(ctx context.Context) bool

CustomHandlerContext reports whether ctx carries the custom-handler marker set by AddRequestInfoToContext.

func GetMetadataFromRequest

func GetMetadataFromRequest(req *http.Request) metadata.MD

GetMetadataFromRequest gets any custom values to be added to request metadata that helps nvkit middleware

func HeaderAppender

func HeaderAppender() grpctransport.ServerResponseFunc

HeaderAppender adds header information to the response NOTE: This function is only called in the success path of go-kit's framework. In the error-path, error-handler handles populating the right header

func HeaderProvider

func HeaderProvider() grpctransport.ServerRequestFunc

HeaderProvider provides a way to append headers to the request context.

func RequestIDFromRequestContext added in v1.0.15

func RequestIDFromRequestContext(ctx context.Context) (string, bool)

RequestIDFromRequestContext returns the request ID stored by AddRequestInfoToContext.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL