Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
method: (request, h) => {
const response = request.response.output
? request.response.output
: request.response;
response.headers['podlet-version'] = podlet.version;
return h.continue;
},
});
// Decorate response with .podiumSend() method
server.decorate('toolkit', 'podiumSend', fragment => {
return this.request.app.podium.render(fragment);
});
// Mount proxy route
const pathname = utils.pathnameBuilder(
podlet._proxy.pathname,
podlet._proxy.prefix,
'/{path*}',
);
server.route([
{
method: '*',
path: pathname,
handler: async request => {
await podlet._proxy.process(request.app.podium);
return '';
},
},
]);
}
};
[_sanitize](uri, prefix = false) {
const pathname = prefix ? this._pathname : '';
if (uri) {
return utils.uriIsRelative(uri)
? utils.pathnameBuilder(pathname, uri)
: uri;
}
return uri;
}
enumerable: true,
value: new Proxy({
pathname: this._pathname,
logger: this.log,
}),
});
Object.defineProperty(this, 'baseContext', {
value: {
debug: 'false',
locale: 'en-US',
deviceType: 'desktop',
requestedBy: this.name,
mountOrigin: '',
mountPathname: this._pathname,
publicPathname: pathnameBuilder(
this.httpProxy.pathname,
this.httpProxy.prefix,
this.name,
),
},
writable: false,
});
Object.defineProperty(this, 'defaultContext', {
value: {},
writable: true,
});
Object.defineProperty(this, 'metrics', {
enumerable: true,
value: new Metrics(),