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

fix: broken test with node 15 #328

Merged
merged 1 commit into from
Jan 21, 2021
Merged

fix: broken test with node 15 #328

merged 1 commit into from
Jan 21, 2021

Conversation

salmanm
Copy link
Collaborator

@salmanm salmanm commented Jan 21, 2021

  const server = http.createServer((req, res) => {
    res.statusCode = 102
    res.end('Hello')
  })
  server.listen(9000)

This simple http server responds differently in Node v14 vs v15.

Response in Node v14

HTTP/1.1 102 Processing
Date: Thu, 21 Jan 2021 15:22:09 GMT
Connection: close

Response in Node v15

HTTP/1.1 102 Processing
Date: Thu, 21 Jan 2021 15:22:09 GMT
Connection: close
Content-Length: 5 // <---

I haven't done a thorough research with node and http specs as to why this behaviour is different but as I understand, the 102 response doesn't return a body. But if you try to send it, Node 14 smartly ignores it and does not send a Content-Length header. However Node 15 sends this header, which is why http-parser-js waits for the body and never fires kOnMessageComplete.

@salmanm salmanm requested a review from mcollina January 21, 2021 15:27
Copy link
Owner

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 54924a0 into master Jan 21, 2021
@mcollina mcollina deleted the fix-node-15 branch January 21, 2021 18:12
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 this pull request may close these issues.

2 participants