@onlineapps/service-wrapper 2.1.61 → 2.1.63

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.
@@ -50,7 +50,7 @@
50
50
  "enabled": true,
51
51
  "headerName": "account-id",
52
52
  "requirePathPrefixes": ["/api/"],
53
- "excludePathPrefixes": ["/api/v1/specification"]
53
+ "excludePathPrefixes": ["/api/v1/specification", "/api/health"]
54
54
  }
55
55
  }
56
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/service-wrapper",
3
- "version": "2.1.61",
3
+ "version": "2.1.63",
4
4
  "description": "Thin orchestration layer for microservices - delegates all infrastructure concerns to specialized connectors",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -56,7 +56,14 @@ function createAccountContextMiddleware(options = {}) {
56
56
  return next();
57
57
  }
58
58
 
59
- const path = req && typeof req.path === 'string' ? req.path : '';
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
  }
package/src/index.js CHANGED
@@ -153,5 +153,6 @@ module.exports = ServiceWrapper;
153
153
  module.exports.ServiceWrapper = ServiceWrapper;
154
154
  module.exports.ConfigLoader = ConfigLoader;
155
155
  module.exports.bootstrap = bootstrap;
156
+ module.exports.createAccountContextMiddleware = createAccountContextMiddleware;
156
157
  module.exports.default = ServiceWrapper;
157
158
  module.exports.VERSION = pkg.version;