Reputation: 1135
I have a program in Node.JS, using Express. When I do a POST request to this program, what is the maximum accepted size for the data in the request? Is there any way to set this size?
Upvotes: 4
Views: 3788
Reputation: 63663
If you are using Express, you can use the limit middleware: http://senchalabs.github.com/connect/middleware-limit.html
If you are interested in it's implementation, it does something like this:
// limit
req.on('data', function(chunk){
received += chunk.length;
if (received > bytes) deny();
});
For more details check the code on github: https://github.com/senchalabs/connect/blob/master/lib/middleware/limit.js
Upvotes: 9