{"comment":{"url":"https://api.github.com/repos/MasoniteFramework/core/comments/30564992","html_url":"https://github.com/MasoniteFramework/core/commit/59f75f8bd03ada4bf38333a4ea89ef9584db10a5#commitcomment-30564992","id":30564992,"node_id":"MDEzOkNvbW1pdENvbW1lbnQzMDU2NDk5Mg==","user":{"login":"josephmancuso","id":20172538,"node_id":"MDQ6VXNlcjIwMTcyNTM4","avatar_url":"https://avatars1.githubusercontent.com/u/20172538?v=4","gravatar_id":"","url":"https://api.github.com/users/josephmancuso","html_url":"https://github.com/josephmancuso","followers_url":"https://api.github.com/users/josephmancuso/followers","following_url":"https://api.github.com/users/josephmancuso/following{/other_user}","gists_url":"https://api.github.com/users/josephmancuso/gists{/gist_id}","starred_url":"https://api.github.com/users/josephmancuso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephmancuso/subscriptions","organizations_url":"https://api.github.com/users/josephmancuso/orgs","repos_url":"https://api.github.com/users/josephmancuso/repos","events_url":"https://api.github.com/users/josephmancuso/events{/privacy}","received_events_url":"https://api.github.com/users/josephmancuso/received_events","type":"User","site_admin":false},"position":6,"line":80,"path":"masonite/providers/RouteProvider.py","commit_id":"59f75f8bd03ada4bf38333a4ea89ef9584db10a5","created_at":"2018-09-19T15:47:37Z","updated_at":"2018-09-19T15:47:37Z","author_association":"MEMBER","body":"so previously the only reason i thought to not hit the view after a group of middleware ran was because of a redirection. (if middleware was redirecting, why hit the view? It wouldn't matter anyway because a user wouldn't see the contents of that view).\r\n\r\nso when redirecting we set a `request.redirect_url` to the new url. So we were checking for that redirection.\r\n\r\nBUT there are other reasons we do not want to hit a view. This can be like the example above, we want to show a 503 error page.\r\n\r\nThe reason is it `request.get_status_code() == '404 Route Not Found':` and not something else is because in the waaayy beginning of the request, we set the status code to `404 Route Not Found` and then run through the request stack (hit all the service providers). If the request is changed then we don't want to hit the view.\r\n\r\nThis MAY be a bad way to do it so this may need to be revisited. There may be a reason to hit a view even if the status code changes in a `before` middleware 🤔 . but i couldn't think of a use case.\r\n\r\nif anything, a status code will change in an `after` middleware. This logic before was only if the route was not redirecting so this is just the same logic really."}}
{"actor":{"display_login":"josephmancuso"}}