feross / feross/simple-get

HTTP 500 response not returned with Node.js 14 and concat

Open
#65 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
402
Forks
49
PR merge metrics
No merged PRs in 30d

Description

After upgrading to Node.js 14, I do not receive HTTP 500 responses with code of the form:

```
get.concat('http://example.com', function (err, res, data) {
} );
```

This can be fixed by checking explicitly for `res.statusCode != 200` in **simple-get**'s **concat** function, i.e.

```
simpleGet.concat = (opts, cb) => {
return simpleGet(opts, (err, res) => {
if (err) return cb(err)
if (res.statusCode != 200) return cb(null,res) // <---- added line
concat(res, (err, data) => {
```

It appears that a change in Node.js 14 means that the stream **end** event is no-longer called in this situation, so simple-concat never returns output.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.