We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
readable.unshift
1 parent db4a3dc commit d77db88Copy full SHA for d77db88
doc/api/stream.md
@@ -1528,7 +1528,7 @@ function parseHeader(stream, callback) {
1528
let chunk;
1529
while (null !== (chunk = stream.read())) {
1530
const str = decoder.write(chunk);
1531
- if (str.match(/\n\n/)) {
+ if (str.includes('\n\n')) {
1532
// Found the header boundary.
1533
const split = str.split(/\n\n/);
1534
header += split.shift();
@@ -1541,10 +1541,10 @@ function parseHeader(stream, callback) {
1541
stream.unshift(buf);
1542
// Now the body of the message can be read from the stream.
1543
callback(null, header, stream);
1544
- } else {
1545
- // Still reading the header.
1546
- header += str;
+ return;
1547
}
+ // Still reading the header.
+ header += str;
1548
1549
1550
0 commit comments