Skip to content

Commit

Permalink
Merge pull request ZJONSSON#140 from ZJONSSON/missing-content-length
Browse files Browse the repository at this point in the history
Reject in Open.url if server does not supply content-length
  • Loading branch information
ZJONSSON committed Aug 1, 2019
2 parents f057511 + ee7e265 commit e60c79f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Open/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ module.exports = {
var req = request(params);
req.on('response',function(d) {
req.abort();
resolve(d.headers['content-length']);
if (!d.headers['content-length'])
reject(new Error('Missing content length header'));
else
resolve(d.headers['content-length']);
}).on('error',reject);
});
}
Expand Down

0 comments on commit e60c79f

Please sign in to comment.