{"action":"closed","issue":{"url":"https://api.github.com/repos/request/request-promise/issues/131","repository_url":"https://api.github.com/repos/request/request-promise","labels_url":"https://api.github.com/repos/request/request-promise/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/request/request-promise/issues/131/comments","events_url":"https://api.github.com/repos/request/request-promise/issues/131/events","html_url":"https://github.com/request/request-promise/issues/131","id":161829848,"number":131,"title":"Option for not transforming error responses","user":{"login":"stevage","id":678344,"avatar_url":"https://avatars.githubusercontent.com/u/678344?v=3","gravatar_id":"","url":"https://api.github.com/users/stevage","html_url":"https://github.com/stevage","followers_url":"https://api.github.com/users/stevage/followers","following_url":"https://api.github.com/users/stevage/following{/other_user}","gists_url":"https://api.github.com/users/stevage/gists{/gist_id}","starred_url":"https://api.github.com/users/stevage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevage/subscriptions","organizations_url":"https://api.github.com/users/stevage/orgs","repos_url":"https://api.github.com/users/stevage/repos","events_url":"https://api.github.com/users/stevage/events{/privacy}","received_events_url":"https://api.github.com/users/stevage/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/request/request-promise/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-06-23T02:54:46Z","updated_at":"2016-07-16T00:40:52Z","closed_at":"2016-07-16T00:40:52Z","body":"I realise I'm too late on this one, and just discovering request-promise now, but this (#86) seems like a really weird change. I'm using transform to extract part of the body of a successful API query. I can't really imagine ever wanting to apply the same function to both successful and unsuccessful queries. \r\n\r\nBefore:\r\n\r\n```\r\n        transform: function(body) {\r\n            return body.files[Object.keys(body.files)[0]].content; // find the contents of the first file in the gist\r\n        }\r\n```\r\n\r\nAfter:\r\n```\r\n        transform: function(body, response) {\r\n            if (!(/^2/.test('' + response.statusCode))) { \r\n                return response\r\n            }\r\n            return body.files[Object.keys(body.files)[0]].content; // find the contents of the first file in the gist\r\n        }\r\n```\r\n\r\nSeems like a lot of ugly boilerplate for nothing.\r\n\r\nPerhaps an option, `transformErrors: false`, to restore the previous behaviour."}}
{"actor":{"display_login":"analog-nico"}}