clientApiUri

This commit is contained in:
AJ ONeal 2017-05-30 17:29:14 +00:00
parent 68e48800c3
commit 614eb960d4
1 changed files with 7 additions and 0 deletions

View File

@ -395,6 +395,7 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
// example.com/subpath/api should resolve to example.com#subapp
// sub.example.com/subpath/api should resolve to sub.example.com#subapp
var clientUrih = req.hostname.replace(/^api\./, '') + req.url.replace(/\/api\/.*/, '/').replace(/\/+/g, '#').replace(/#$/, '');
var clientApiUri = req.hostname + req.url.replace(/\/api\/.*/, '/').replace(/\/$/, '');
// Canonical package names
// '/api/com.daplie.hello/hello' should resolve to 'com.daplie.hello'
// '/subapp/api/com.daplie.hello/hello' should also 'com.daplie.hello'
@ -410,6 +411,12 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
, writable: false
, value: clientUrih
});
Object.defineProperty(req, 'clientApiUri', {
enumerable: true
, configurable: false
, writable: false
, value: clientApiUri
});
Object.defineProperty(req, 'apiId', {
enumerable: true
, configurable: false