Skip to content

Instantly share code, notes, and snippets.

@ericelliott
Created September 12, 2013 00:27
Show Gist options
  • Save ericelliott/6531724 to your computer and use it in GitHub Desktop.
Save ericelliott/6531724 to your computer and use it in GitHub Desktop.
Easy to crash express service.
Unexpected end of input
SyntaxError: Unexpected end of input
at Object.parse (native)
at IncomingMessage.module.exports (/Users/erhamilt/dev/ccweb-main/node_modules/connect/lib/middleware/json.js:76:27)
at IncomingMessage.EventEmitter.emit (events.js:93:17)
at IncomingMessage._emitEnd (http.js:366:10)
at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)
at Socket.socket.ondata (http.js:1825:22)
at TCP.onread (net.js:404:27)
var http = require('http');
var data = JSON.stringify({
firstName: 'JoaquÌn. Do you get it',
});
var options = {
host: 'localhost',
port: 8888,
path: '/',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
};
var requests = 10000;
function doRequest() {
var req = http.request(options, function(res) {
var result = '';
res.on('data', function(chunk) {
result += chunk;
});
res.on('end', function() {
console.log(result);
});
});
req.on('error', function(err) {
console.log(err);
});
req.write(data);
req.end();
}
while (requests) {
doRequest();
requests--;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment