{"action":"created","issue":{"url":"https://api.github.com/repos/jnunemaker/httparty/issues/392","labels_url":"https://api.github.com/repos/jnunemaker/httparty/issues/392/labels{/name}","comments_url":"https://api.github.com/repos/jnunemaker/httparty/issues/392/comments","events_url":"https://api.github.com/repos/jnunemaker/httparty/issues/392/events","html_url":"https://github.com/jnunemaker/httparty/issues/392","id":69555869,"number":392,"title":"After request hooks","user":{"login":"23tux","id":38003,"avatar_url":"https://avatars.githubusercontent.com/u/38003?v=3","gravatar_id":"","url":"https://api.github.com/users/23tux","html_url":"https://github.com/23tux","followers_url":"https://api.github.com/users/23tux/followers","following_url":"https://api.github.com/users/23tux/following{/other_user}","gists_url":"https://api.github.com/users/23tux/gists{/gist_id}","starred_url":"https://api.github.com/users/23tux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/23tux/subscriptions","organizations_url":"https://api.github.com/users/23tux/orgs","repos_url":"https://api.github.com/users/23tux/repos","events_url":"https://api.github.com/users/23tux/events{/privacy}","received_events_url":"https://api.github.com/users/23tux/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-20T10:25:17Z","updated_at":"2015-04-23T23:09:22Z","closed_at":"2015-04-23T23:09:22Z","body":"Hi,\r\n\r\nwhen I have HTTParty included in my class, is it possible to run a piece of code like an after hook, that performs some checks on the response?\r\n\r\nBackground: I have a class with a lot of methods, and I want to check if the `response.code` is an unauthorized 401 or a permission denied 403. It would lead to a lot of code duplication, if I had to call a method that is given the response from a get or a post request, and checks if the code is right.\r\n\r\nI tried it with a block as third argument, but the block only gets the response body."},"comment":{"url":"https://api.github.com/repos/jnunemaker/httparty/issues/comments/95743532","html_url":"https://github.com/jnunemaker/httparty/issues/392#issuecomment-95743532","issue_url":"https://api.github.com/repos/jnunemaker/httparty/issues/392","id":95743532,"user":{"login":"jnunemaker","id":235,"avatar_url":"https://avatars.githubusercontent.com/u/235?v=3","gravatar_id":"","url":"https://api.github.com/users/jnunemaker","html_url":"https://github.com/jnunemaker","followers_url":"https://api.github.com/users/jnunemaker/followers","following_url":"https://api.github.com/users/jnunemaker/following{/other_user}","gists_url":"https://api.github.com/users/jnunemaker/gists{/gist_id}","starred_url":"https://api.github.com/users/jnunemaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnunemaker/subscriptions","organizations_url":"https://api.github.com/users/jnunemaker/orgs","repos_url":"https://api.github.com/users/jnunemaker/repos","events_url":"https://api.github.com/users/jnunemaker/events{/privacy}","received_events_url":"https://api.github.com/users/jnunemaker/received_events","type":"User","site_admin":true},"created_at":"2015-04-23T23:09:21Z","updated_at":"2015-04-23T23:09:21Z","body":"There is not. I typically just make my own class that wraps httparty and does this. Hooks like this can add a lot of slowness to libraries in my experience, even when they aren't used."}}