// SetRequestId returns a shallow copy of the origin request, with a request ID created or extracted from the X-Request-ID header
SetRequestId returns a shallow copy of the origin request, with a request ID created or extracted from the X-Request-ID header
// SetRequestId returns a shallow copy of the origin request with a request ID created or extracted from the X - Request - ID header
func SetRequestId(r *http.Request) *http.Request {
	id := r.Header.Get(DefaultRequestHeader)
	if id == "" {
		id = uuid.New().String()
		log.WithField("id", id).Debugf("failed to locate existing request ID, generating a new one...")
	}
	ctx := context.WithValue(r.Context(), DefaultContextKey, id)
	return r.WithContext(context.WithValue(ctx, ContextKeyID, id))
}
func SetRequestId ( r * http . Request ) * http . Request { id := r . Header . Get ( DefaultRequestHeader ) if id == " " { id = uuid . New ( ) . String ( ) log . WithField ( " " , id ) . Debugf ( " " ) } ctx := context . WithValue ( r . Context ( ) , DefaultContextKey , id ) return r . WithContext ( context . WithValue ( ctx , ContextKeyID , id ) ) }
SetRequestId returns a shallow copy of the origin request, with a request ID created or extracted from the X-Request-ID header
SetRequestId returns a shallow copy of the origin request with a request ID created or extracted from the X - Request - ID header
// if we didn't get an id, create one // store the legacy value for compat // update the request context