We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
readable.unshift
1 parent 2b329da commit 4c0ad1cCopy full SHA for 4c0ad1c
doc/api/stream.md
@@ -1532,7 +1532,7 @@ function parseHeader(stream, callback) {
1532
let chunk;
1533
while (null !== (chunk = stream.read())) {
1534
const str = decoder.write(chunk);
1535
- if (str.match(/\n\n/)) {
+ if (str.includes('\n\n')) {
1536
// Found the header boundary.
1537
const split = str.split(/\n\n/);
1538
header += split.shift();
@@ -1545,10 +1545,10 @@ function parseHeader(stream, callback) {
1545
stream.unshift(buf);
1546
// Now the body of the message can be read from the stream.
1547
callback(null, header, stream);
1548
- } else {
1549
- // Still reading the header.
1550
- header += str;
+ return;
1551
}
+ // Still reading the header.
+ header += str;
1552
1553
1554
0 commit comments