dvWithRequestPrivacy<T> function

Future<T> dvWithRequestPrivacy<T>(
  1. Object? request,
  2. Future<T> body()
)

Runs body with request's Global Privacy Control signal in force for all of it.

The generated backend wraps every request in this, beside the tenant scope and for the same reason: a signal written to a field at the top of a handler belongs to whichever request arrived last, and here that means honouring one visitor's opt-out for another while collecting from the one who sent it.

What reads it is DVConsent.isGranted, which denies a tracking category while the signal is in force. Nothing else has to remember to ask.

Implementation

Future<T> dvWithRequestPrivacy<T>(Object? request, Future<T> Function() body) =>
    dvWithPrivacyOptOut(
      dvGlobalPrivacyControl(_requestHeaders(request)),
      body,
    );