const buffer=[];
req.on("data",function(chunk){
buffer.push(chunk);
}
req.on("end",function(){
//this will cause data to be lost often if its a really large String
const missingData = buffer.toString()
//this wouldnt cause data to be lost
const fullData = Buffer.concat(buffer).toString();
})
even if this is a wrong way of receiving data at least there should be an error I haven't found anything online so I spent several days wondering why there was data missing in the end, if you want to reproduce the bug use a large JSON string (my string had 500000 characters) in the post request and then try parsing it in the Node.js server
How often does it reproduce? Is there a required condition?
It sometimes works but sometimes doesnt it feels like it's random
What is the expected behavior? Why is that the expected behavior?
The expected behavior would be to receive the full data in the end of the request because it works with smaller JSON string
What do you see instead?
Instead I receive an invalid JSON string because data is missing or being lost while parsing
Additional information
Even if this is a wrong way of receiving data at least there should be an error
Version
v19.6.1
Platform
Microsoft Windows NT 10.0.19045.0 x64
Subsystem
No response
What steps will reproduce the bug?
even if this is a wrong way of receiving data at least there should be an error I haven't found anything online so I spent several days wondering why there was data missing in the end, if you want to reproduce the bug use a large JSON string (my string had 500000 characters) in the post request and then try parsing it in the Node.js server
How often does it reproduce? Is there a required condition?
It sometimes works but sometimes doesnt it feels like it's random
What is the expected behavior? Why is that the expected behavior?
The expected behavior would be to receive the full data in the end of the request because it works with smaller JSON string
What do you see instead?
Instead I receive an invalid JSON string because data is missing or being lost while parsing
Additional information
Even if this is a wrong way of receiving data at least there should be an error