index.js
function parseRes (res, cb) {
    var body = '';
    if ('setEncoding' in res) res.setEncoding('utf-8');

    res.on('data', function (data) {
        body += data;
        if (body.length > 1e10) {
            // FLOOD ATTACK OR FAULTY CLIENT, NUKE REQ
            res.connection.destroy();
            res.writeHead(413, {'Content-Type': 'text/plain'});
            res.end('req body too large');
            return cb(new Error('body overflow'));
        }
    });

    res.on('end', function () {
        cb(null, body);
    });

}
function parseRes (res, cb) {
    var body = '';
    if ('setEncoding' in res) res.setEncoding('utf-8');

    res.on('data', function (data) {
        body += data;
        if (body.length > 1e10) {
            // FLOOD ATTACK OR FAULTY CLIENT, NUKE REQ
            res.connection.destroy();
            res.writeHead(413, {'Content-Type': 'text/plain'});
            res.end('req body too large');
            return cb(new Error('body overflow'));
        }
    });

    res.on('end', function () {
        cb(null, body);
    });

}
function parseRes ( res , cb ) { var body = '' ; if ( 'setEncoding' in res ) res . setEncoding ( 'utf-8' ) ; res . on ( 'data' , function ( data ) { body += data ; if ( body . length > 1e10 ) { // FLOOD ATTACK OR FAULTY CLIENT, NUKE REQ res . connection . destroy ( ) ; res . writeHead ( 413 , { 'Content-Type' : 'text/plain' } ) ; res . end ( 'req body too large' ) ; return cb ( new Error ( 'body overflow' ) ) ; } } ) ; res . on ( 'end' , function ( ) { cb ( null , body ) ; } ) ; }
response parse helper fn
response parse helper fn