I have a policy that is being used to randomly assign modified view files for the sake of split testing. In my routes.js
file I have something along the lines of:
'/some-page': {
controller: 'PageController',
action: 'viewPage',
locals: {
view: 'some-page.handlebars'
}
}
I then have a policy, splits.js
that, if it detects a split test is active on this path, amends req.options.locals.view
to be something like "some-split-test.handlebars". However, when the app gets to the controller req.options.locals.view
has reverted back to the value assigned in routes.js
(ie "some-page.handlebars"). The policy is being called and working as expected - if I log req.options.locals.view
at the end, it has the updated value.
Am I fundamentally misunderstanding the relationship here between policies and controllers and their ability to manipulate req.options
?