-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Specifically, I'm looking at these lines in src/index.js:
if (res.statusCode === 200) {
resolve(Object.assign({responseText, buffer}, res));
} else {
const error = new Error('Response error');
error.responseText = responseText;
reject(error);
}
This test is a bit too strict: any HTTP status code bewteen 200 and 299 should be considered successful and not throw an error.
Also, it would be nice if the Error thrown, in addition to the responseText property, included a responseCode property that contained res.statusCode, as that's useful information when handling errors.
Metadata
Metadata
Assignees
Labels
No labels