We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 76d03a7 commit 4a3531cCopy full SHA for 4a3531c
1 file changed
lib/client.js
@@ -714,8 +714,13 @@ class Parser {
714
this.statusCode = statusCode
715
this.shouldKeepAlive = (
716
shouldKeepAlive ||
717
- // Override llhttp value which does not allow keepAlive for HEAD.
718
- (request.method === 'HEAD' && !socket[kReset] && this.connection.toLowerCase() === 'keep-alive')
+ // Override llhttp value which does not allow keepAlive for HEAD and 204 and 304
+ // responses.
719
+ (
720
+ (request.method === 'HEAD' || this.statusCode === 204 || this.statusCode === 304) &&
721
+ !socket[kReset] &&
722
+ this.connection.toLowerCase() === 'keep-alive'
723
+ )
724
)
725
726
if (this.statusCode >= 200) {
0 commit comments