I'm currently working on creating test cases for a web application and I am interested in testing how well the client can handle invalid HTTP responses. Can you provide some suggestions on how to purposely mess up a response so that it is no longer valid? I attempted the method below, but it seems that Express automatically corrected the Content-Length
:
app.get('/broken/', function(req, res) {
console.log('request received for ' + req.path);
res.set('Content-Length', 0).send('more than zero');
});
UPDATE: It's worth mentioning that I do not have full control over the incoming requests. There have been instances where they were invalid in the past.