@onlineapps/service-wrapper 2.1.61 → 2.1.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -56,7 +56,14 @@ function createAccountContextMiddleware(options = {}) {
|
|
|
56
56
|
return next();
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
// Prefer originalUrl because req.path may be relative inside mounted routers (e.g. '/documents')
|
|
60
|
+
// while originalUrl keeps the full path (e.g. '/api/v1/documents').
|
|
61
|
+
const rawUrl =
|
|
62
|
+
(req && typeof req.originalUrl === 'string' && req.originalUrl) ||
|
|
63
|
+
(req && typeof req.url === 'string' && req.url) ||
|
|
64
|
+
(req && typeof req.path === 'string' && req.path) ||
|
|
65
|
+
'';
|
|
66
|
+
const path = rawUrl.split('?')[0];
|
|
60
67
|
if (!requirePrefixes.some(prefix => path.startsWith(prefix))) {
|
|
61
68
|
return next();
|
|
62
69
|
}
|