Makes HTTPResponse serializable (#2143)
* Use the callback body instead of response.body that may not be set * Adds test to handle undefined responses * Adds toJSON method to properly serialize HTTPResponse * Use ES5 defineProperty to make keys enumerable * removes body key from serialization * Indent nits
This commit is contained in:
committed by
Tyler Brock
parent
35b4c063fb
commit
3e413683f7
@@ -62,7 +62,7 @@ module.exports = function(options) {
|
||||
}
|
||||
return promise.reject(error);
|
||||
}
|
||||
let httpResponse = new HTTPResponse(response);
|
||||
let httpResponse = new HTTPResponse(response, body);
|
||||
|
||||
// Consider <200 && >= 400 as errors
|
||||
if (httpResponse.status < 200 || httpResponse.status >= 400) {
|
||||
|
||||
Reference in New Issue
Block a user