Titan icon indicating copy to clipboard operation
Titan copied to clipboard

Titan Predicate ignores prior responses

Open swizzlr opened this issue 7 years ago • 1 comments

titan.get("/index") { ... }

titan.predicate(isAuthenticated, true: {
  titan.get("/user") { ... }
}, false: {
  titan.addFunction { "Not Authorised" }
})

A request to /index will set the response in the chain to be the index page. However, Titan predicate is implemented with a shadowed Titan instance, which by default sets the response to -1.

I'm loath to change the TitanCore API, though I think that might be required. The other way to do it would be through some kind of equality checking and leapfrogging the prior response to the other side of the inner Titan chain if no match is found.

swizzlr avatar Jun 26 '17 10:06 swizzlr