Skip to content

Commit e9fc6a7

Browse files
update
1 parent 0c49815 commit e9fc6a7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

examples/express-app/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ The targeting mechanism uses the `exampleTargetingContextAccessor` to extract th
4141
const exampleTargetingContextAccessor = {
4242
getTargetingContext: () => {
4343
const req = requestAccessor.getStore();
44+
if (req === undefined) {
45+
return undefined;
46+
}
4447
// read user and groups from request query data
4548
const { userId, groups } = req.query;
4649
// return aa ITargetingContext with the appropriate user info

examples/express-app/server.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const requestAccessor = new AsyncLocalStorage();
1515
const exampleTargetingContextAccessor = {
1616
getTargetingContext: () => {
1717
const req = requestAccessor.getStore();
18+
if (req === undefined) {
19+
return undefined;
20+
}
1821
// read user and groups from request query data
1922
const { userId, groups } = req.query;
2023
// return an ITargetingContext with the appropriate user info

0 commit comments

Comments
 (0)