{"action":"created","issue":{"url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/480","repository_url":"https://api.github.com/repos/SergioBenitez/Rocket","labels_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/480/labels{/name}","comments_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/480/comments","events_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/480/events","html_url":"https://github.com/SergioBenitez/Rocket/issues/480","id":275214356,"number":480,"title":"Introduce `FromRequest::on_entry()`","user":{"login":"dpc","id":9209,"avatar_url":"https://avatars2.githubusercontent.com/u/9209?v=4","gravatar_id":"","url":"https://api.github.com/users/dpc","html_url":"https://github.com/dpc","followers_url":"https://api.github.com/users/dpc/followers","following_url":"https://api.github.com/users/dpc/following{/other_user}","gists_url":"https://api.github.com/users/dpc/gists{/gist_id}","starred_url":"https://api.github.com/users/dpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpc/subscriptions","organizations_url":"https://api.github.com/users/dpc/orgs","repos_url":"https://api.github.com/users/dpc/repos","events_url":"https://api.github.com/users/dpc/events{/privacy}","received_events_url":"https://api.github.com/users/dpc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-20T01:40:27Z","updated_at":"2017-11-22T15:23:36Z","closed_at":null,"author_association":"NONE","body":"## Feature Requests\r\n\r\n### Why you believe this feature is necessary.\r\n\r\nRight now `FromRequest::from_request` logic can only operate before the route is taken, typically to decide if the route should be taken or not. It would make request guards more powerful if they were able to do some stuff after the route was actually taken.\r\n\r\n## Convincing use-case\r\n\r\nI have a rate-limiting type, and I'd like the rate-limiting logic to check rete limits after the actual route was matched and taken, but I don't want to have to call it everywhere manually.\r\n\r\nPotentially this could be used to fix #466  by clearing the `Flash` only when route was taken.\r\n\r\n## Why this feature can't or shouldn't exist outside of Rocket.\r\n\r\nRocket controls what gets called and when.\r\n\r\n## Notes\r\nThis could be implemented by adding new method to `FromRequest` with no-op default implementation and generated code calling it on all request guards before calling the handler function.\r\n\r\nMaybe `on_exit` would be useful too."},"comment":{"url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/comments/346382489","html_url":"https://github.com/SergioBenitez/Rocket/issues/480#issuecomment-346382489","issue_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/480","id":346382489,"user":{"login":"SergioBenitez","id":1480321,"avatar_url":"https://avatars3.githubusercontent.com/u/1480321?v=4","gravatar_id":"","url":"https://api.github.com/users/SergioBenitez","html_url":"https://github.com/SergioBenitez","followers_url":"https://api.github.com/users/SergioBenitez/followers","following_url":"https://api.github.com/users/SergioBenitez/following{/other_user}","gists_url":"https://api.github.com/users/SergioBenitez/gists{/gist_id}","starred_url":"https://api.github.com/users/SergioBenitez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergioBenitez/subscriptions","organizations_url":"https://api.github.com/users/SergioBenitez/orgs","repos_url":"https://api.github.com/users/SergioBenitez/repos","events_url":"https://api.github.com/users/SergioBenitez/events{/privacy}","received_events_url":"https://api.github.com/users/SergioBenitez/received_events","type":"User","site_admin":false},"created_at":"2017-11-22T15:23:36Z","updated_at":"2017-11-22T15:23:36Z","author_association":"OWNER","body":"Can you detail further why it's important that you know which route was taken in your example of rate-limiting? In `on_request`, you have the complete request information, including the path. I'm wondering: why isn't this sufficient?\n\nI believe you can also implement what you're suggesting as a request guard. Then you'd simple need to add the type to the route's signature to get the functionality you're looking. This way, you also have the flexibility to order guards the way you'd like."}}
{"actor":{"display_login":"SergioBenitez"}}