Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arachnetech opened this issue May 12, 2021 · 1 comment
Open

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

arachnetech opened this issue May 12, 2021 · 1 comment

Comments

@arachnetech
Copy link

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.

@bendrucker
Copy link
Collaborator

See #66, I added some test coverage to validate that this behavior continues to work in Node 14. It would be really unexpected for http to change stream handling to change based on a status code, that's a higher (user) level concern.

If you could share runnable code that might help identify your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants