Skip to content

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/request.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default url => {
99

1010
const request = https.get(url, response => {
1111
if (response.statusCode < 200 || response.statusCode > 299) {
12+
response.destroy();
1213
return reject(new Error(`Failed to load page, status code: ${response.statusCode}`));
1314
}
1415
let body = [];

test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('request', function() {
112112
);
113113
});
114114

115-
it('should throw an error if no URL has been specified', () => {
115+
it('should throw an error if a wrong URL has been specified', () => {
116116
return request('https://npmjs.org/registry/package-age').then(() =>
117117
Promise.reject(new Error('Expected method to reject.'))
118118
).catch(error =>

0 commit comments

Comments
 (0)