-
Notifications
You must be signed in to change notification settings - Fork 291
Closed
Labels
Description
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.
Before:
transform: function(body) {
return body.files[Object.keys(body.files)[0]].content; // find the contents of the first file in the gist
}
After:
transform: function(body, response) {
if (!(/^2/.test('' + response.statusCode))) {
return response
}
return body.files[Object.keys(body.files)[0]].content; // find the contents of the first file in the gist
}
Seems like a lot of ugly boilerplate for nothing.
Perhaps an option, transformErrors: false
, to restore the previous behaviour.