diff --git a/openstack_dashboard/contrib/developer/static/dashboard/developer/profiler/profiler.module.js b/openstack_dashboard/contrib/developer/static/dashboard/developer/profiler/profiler.module.js index 5f2e612b13..9b401d16b7 100644 --- a/openstack_dashboard/contrib/developer/static/dashboard/developer/profiler/profiler.module.js +++ b/openstack_dashboard/contrib/developer/static/dashboard/developer/profiler/profiler.module.js @@ -31,12 +31,20 @@ '$provide', '$windowProvider', '$httpProvider', - 'horizon.dashboard.developer.profiler.headers' + '$injector' ]; - function config($provide, $windowProvider, $httpProvider, headers) { + function config($provide, $windowProvider, $httpProvider, $injector) { var path = $windowProvider.$get().STATIC_URL + 'dashboard/developer/profiler/'; $provide.constant('horizon.dashboard.developer.profiler.basePath', path); + + // the headers constant is defined by HTML code, which doesn't exist in some + // contexts (eg. jasmine.html), so we need to handle it not being defined at all + var headers = {}; + if ($injector.has('horizon.dashboard.developer.profiler.headers')) { + headers = $injector.get('horizon.dashboard.developer.profiler.headers'); + } + if (Object.keys(headers).length) { $httpProvider.interceptors.push(function() { return {